title: How to receive images from Raspberry Pi over ZeroMQ PUB/SUB in Python?
body: <p>I want to send images taken by Picamera on Raspberry Pi to my windows computer.</p>
  <p>I wrote some code, as follows (they are simplified here), but it gets stuck in  <br><code>frame = footage_socket.recv_string()</code>  in the <code>client.py</code>.</p>
  <p>I don't get any error but it always gets stuck in the code like it freezes and can't go to the next line.  The <code>server.py</code> works fine and prints <code>'test'</code> continuously. If you look at the <code>jpg_as_text</code>, you can see encoded texts.</p>
  <p><strong><code>server.py</code> :</strong></p>
  <pre><code>import picamera
  import socket
  import threading
  import zmq
  import cv2
  import base64
  from picamera.array import PiRGBArray
  
  if __name__ == &quot;__main__&quot;:
  
      addr = 'ip_address'
  
      camera = picamera.PiCamera()                 # Camera initialization
      camera.resolution = (640, 480)
      camera.framerate = 7
      rawCapture = PiRGBArray(camera, size=(640, 480))
  
      # FPV initialization
      context = zmq.Context()
      footage_socket = context.socket(zmq.PUB)
      footage_socket.connect('tcp://%s:5555'%addr)
      print(addr)
  
      font = cv2.FONT_HERSHEY_SIMPLEX
      for frame in camera.capture_continuous( rawCapture,
                                              format         = &quot;bgr&quot;,
                                              use_video_port = True ):
          image = frame.array
          print('test')
          image = cv2.resize(image, (640, 480))    # resize the frame
          encoded, buffer = cv2.imencode('.jpg', image)
          jpg_as_text = base64.b64encode(buffer)
          footage_socket.send(jpg_as_text)
          rawCapture.truncate(0)
  </code></pre>
  <p><strong><code>client.py</code></strong> :</p>
  <pre><code>from socket import *
  import sys
  import time
  import threading as thread
  import tkinter as tk
  import math
  import os
  import cv2
  import zmq
  import base64
  import numpy as np
  
  
  if __name__ == &quot;__main__&quot;:
  
      context = zmq.Context()
      footage_socket = context.socket(zmq.SUB)
      footage_socket.bind('tcp://*:5555')
      footage_socket.setsockopt_string(zmq.SUBSCRIBE, np.unicode(''))
  
      font = cv2.FONT_HERSHEY_SIMPLEX
  
      while 100:
          try:
              frame = footage_socket.recv_string() # This line of code is the problem.
  
              print('next successfuly connected')
              img = base64.b64decode(frame)
              npimg = np.frombuffer(img, dtype=np.uint8)
              source = cv2.imdecode(npimg, 1)
              cv2.imshow(&quot;Stream&quot;, source)
              cv2.waitKey(1)
  
          except KeyboardInterrupt:
              break
          except:
              pass
      
  </code></pre>