title: Trying to send simple messages with zeromq in python between two hosts
body: <p>Script running on machine 1</p>
  
  <pre><code>import zmq
  
  context = zmq.Context()
  socket = context.socket(zmq.SUB)
  socket.bind("tcp://127.0.0.1:5000")
  print "socket bound"
  
  while True:
      print "Waiting for message"
      message = socket.recv()
      print "message received: " + str(message)
  </code></pre>
  
  <p>This script gets to the socket.recv() and then never returns from that call.</p>
  
  <p>The process that sends the data runs on machine2</p>
  
  <pre><code>import zmq
  
  context = zmq.Context()
  socket = context.socket(zmq.PUB)
  print "socket created"
  socket.connect("tcp://machine2:5000")
  print "socket connected"
  
  for i in range(1, 3):
      print "About to send " + str(i)
      socket.send("Hello " + str(i))
      print "Sent " + str(i)
  
  print "About to close socket"
  socket.close()
  
  print "Socket closed"
  </code></pre>
  
  <p>Executes to completion, but never finishes...</p>
  
  <pre><code>$ python bar.py
  socket created
  socket connected
  About to send 1
  Sent 1
  About to send 2
  Sent 2
  About to close socket
  Socket closed
  </code></pre>
  
  <p>I'm obviously doing it wrong, how do I create a 'queue' to receive multiple messages from publishes on remote hosts?</p>