def send_message(): outsock = DieselZMQSocket(zctx.socket(zmq.DEALER), connect="tcp://127.0.0.1:5000") for x in xrange(500000): outsock.send("yo dawg %s" % x) if x % 1000 == 0: sleep()
def handle_messages(): insock = DieselZMQSocket(zctx.socket(zmq.DEALER), bind="inproc://foo") for x in xrange(500000): msg = insock.recv() assert msg == "yo dawg %s" % x delt = time.time() - t print "500000 messages in %ss (%.1f/s)" % (delt, 500000.0 / delt) quickstop()
def send_message(): global t outsock = DieselZMQSocket(zctx.socket(zmq.DEALER), connect="inproc://foo") t = time.time() for x in xrange(500000): outsock.send("yo dawg %s" % x) if x % 1000 == 0: sleep()
def echo_client(): sock = zctx.socket(zmq.DEALER) sock.identity = "client:%d" % cids.pop() s = DieselZMQSocket(sock, connect='tcp://127.0.0.1:4321') for i in xrange(10): s.send('msg:%d' % i) r = s.recv() assert r == 'msg:%d' % i print sock.identity, 'received', r
def get_messages(): outsock = DieselZMQSocket(zctx.socket(zmq.DEALER), bind="tcp://127.0.0.1:5000") for x in xrange(1000): t, m = first(sleep=1.0, waits=[outsock]) if t == 'sleep': print "sleep timeout!" else: print "zmq:", m quickstop()
def get_messages(): outsock = DieselZMQSocket(zctx.socket(zmq.DEALER), bind="tcp://127.0.0.1:5000") t = time.time() for x in xrange(500000): msg = outsock.recv() assert msg == "yo dawg %s" % x if x % 1000 == 0: sleep() delt = time.time() - t print "500000 messages in %ss (%.1f/s)" % (delt, 500000.0 / delt) quickstop()