[zeromq-dev] some notes on using zmq_poll() with ZMQ_SUB socket

Pavel Gushcha pavimus at gmail.com
Tue Jan 12 10:48:04 CET 2010

I tried to use zmq_poll() on two ZMQ_SUB socket and get strange
behaviour. After looking at source code, i understood that i must use
non blocking recv() on socket after zmq_poll(). This is because
zmq_poll() will return if in ZMQ_SUB socket is message available, but
it is not matching to subscribed topics. When after zmq_poll() you use
blocking recv() it will filter this non matching message and will wait
for another message from only this socket. When you use non blocking
recv() you will get EINPROGRESS and you can do zmq_poll() next time.

I am right? If so, may be some words can be added to zmq_poll() man
page about this usecase?

More information about the zeromq-dev mailing list