def slow_responder():
 ctx = zmq.Context.instance()
 socket = ctx.socket(zmq.REP)
 socket.linger = 0
 socket.bind('tcp://127.0.0.1:5555')
 i = 0
 while True:
  msg = socket.recv()
  print ('\nworker received %r\n' % msg)
  time.sleep(random.randint(1, 5))
  socket.send((msg + (' to you too, #%i' % i)))
  i += 1

def slow_responder ( ) : ctx = zmq . Context . instance ( ) socket = ctx . socket ( zmq . REP ) socket . linger = 0 socket . bind ( 'tcp://127.0.0.1:5555' ) i = 0 while True : msg = socket . recv ( ) print ( '\nworker received %r\n' % msg ) time . sleep ( random . randint ( 1 , 5 ) ) socket . send ( ( msg + ( ' to you too, #%i' % i ) ) ) i += 1
thread for slowly responding to replies .