[zeromq-dev] How to make recv() non blocking

Ronald Swain proj_symbian at live.com
Tue Apr 3 11:23:02 CEST 2012


Hello All,

After a long time i have a question and it seems to be the simple one.

I am using following code to receive something using PyZMQ:

import zmq
zmqContext = zmq.Context()
recevSock = zmqContext.socket(zmq.SUB)
recevSock.connect('address')
recevSock.setsockopts(zmq.SUBSCRIBE.' ')
recevSock.recv()

But the call to recv is blocking my code, so what is the best routine to make that non blocking, i read the docs and they say that i have to set a FLAG NOBLOCK in the method, but when i do so :

recevSock.recv(flags=1)

it throws exception: zmq.core.error.ZMQError: Resource temporarily unavailable

Can any body please help me to move forward.

Regards,
Ronald
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120403/9a882eca/attachment.htm>


More information about the zeromq-dev mailing list