title: zero-mq: socket.recv() call is blocking
body: <p>I am trying to use zero-mq.My requirement is very simple.I want to be able to communicate between two peers in a network.I came across this program in the examples in the book.</p>
  
  <p><code>$ pub_server.py</code></p>
  
  <pre><code>import zmq
  import random
  import sys
  import time
  
  port = "5556"
  if len(sys.argv) &gt; 1:
      port =  sys.argv[1]
      int(port)
  
  context = zmq.Context()
  socket = context.socket(zmq.PUB)
  socket.bind("tcp://*:%s" % port)
  
  while True:
      topic = random.randrange(9999,10005)
      messagedata = random.randrange(1,215) - 80
      print "%d %d" % (topic, messagedata)
      socket.send("%d %d" % (topic, messagedata))
      time.sleep(1)
  </code></pre>
  
  <p><code>$sub_client.py</code></p>
  
  <pre><code>import sys
  import zmq
  
  port = "5556"
  if len(sys.argv) &gt; 1:
      port =  sys.argv[1]
      int(port)
  
  # Socket to talk to server
  context = zmq.Context()
  socket = context.socket(zmq.SUB)
  
  print "Collecting updates from weather server..."
  socket.connect ("tcp://localhost:%s" % port)
  
  # Subscribe to zipcode, default is NYC, 10001
  topicfilter = "10001"
  socket.setsockopt(zmq.SUBSCRIBE, topicfilter)
  
  # Process 5 updates
  total_value = 0
  for update_nbr in range (5):
      string = socket.recv()
      topic, messagedata = string.split()
      total_value += int(messagedata)
      print ('{} {}'.format(topic, messagedata))
  
  print('Avg data value for topic {} was {}'.format(topicfilter, (total_value/update_nbr)))
  </code></pre>
  
  <p>The problem I have with this model is that </p>
  
  <p><code>string = socket.recv()</code></p>
  
  <p>blocks till I recieve a message.I don't want this to happen.I want the messages to be queued up on the recieve side so that I can get it out of the queue (or something similar to this)</p>
  
  <p>Is there some model in zero-mq that allows this?</p>