Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Load Normal ZMQ
- import zmq
- # Connect To Control Socket
- networkContext = zmq.Context(1)
- workDispatcherSocket = networkContext.socket(zmq.REQ)
- workDispatcherSocket.connect("tcp://%s:%s" % ('127.0.0.1','9988'))
- try:
- workDispatcherSocket.recv(flags=zmq.NOBLOCK)
- except zmq.ZMQError as e:
- # Capture Socket Not Ready Error , If Not EAGAIN Log..
- if e.errno != zmq.EFSM:
- print "Normal ZMQ - EFSM Raised"
- elif e.errno != zmq.EAGAIN:
- print "Normal ZMQ - EAGAIN Raised"
- else:
- print "Normal ZMQ - Other Raised %s " % e.errno
- #
- # Now Green ZMQ
- #
- workDispatcherSocket.close(linger=0)
- networkContext.term()
- del zmq
- # Green Zmq
- import zmq.green as zmq
- # Connect To Control Socket
- networkContext = zmq.Context(1)
- workDispatcherSocket = networkContext.socket(zmq.REQ)
- workDispatcherSocket.connect("tcp://%s:%s" % ('127.0.0.1','9988'))
- try:
- workDispatcherSocket.recv(flags=zmq.NOBLOCK)
- except zmq.ZMQError as e:
- # Capture Socket Not Ready Error , If Not EAGAIN Log..
- if e.errno != zmq.EFSM:
- print "Green ZMQ - EFSM Raised"
- elif e.errno != zmq.EAGAIN:
- print "Green ZMQ - EAGAIN Raised"
- else:
- print "Green ZMQ - Other Raised %s " % e.errno
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement