def latency_echo(url, count, poll, copy):
 ctx = zmq.Context()
 s = ctx.socket(zmq.REP)
 if poll:
  p = zmq.Poller()
  p.register(s)
 s.bind(url)
 block = (zmq.NOBLOCK if poll else 0)
 for i in range(count):
  if poll:
   res = p.poll()
  msg = s.recv(block, copy=copy)
  if poll:
   res = p.poll()
  s.send(msg, block, copy=copy)
 msg = s.recv()
 assert (msg == 'done')
 s.close()
 ctx.term()

def latency_echo ( url , count , poll , copy ) : ctx = zmq . Context ( ) s = ctx . socket ( zmq . REP ) if poll : p = zmq . Poller ( ) p . register ( s ) s . bind ( url ) block = ( zmq . NOBLOCK if poll else 0 ) for i in range ( count ) : if poll : res = p . poll ( ) msg = s . recv ( block , copy = copy ) if poll : res = p . poll ( ) s . send ( msg , block , copy = copy ) msg = s . recv ( ) assert ( msg == 'done' ) s . close ( ) ctx . term ( )
echo messages on a rep socket should be started before latency .