[zeromq-dev] Blocking when receiving multipart messages
algrant at acm.org
Wed Aug 8 11:58:22 CEST 2018
I'm receiving multipart messages on a SUB socket and I want to make my
code non-blocking. The docs say that a multipart message is delivered
atomically. Can I read that as a guarantee that, if there is a 'more'
after a previous part, a zmq_recv() on the next part will never block but
immediately read the next part?
If I can rely on that guarantee then I only need to use ZMQ_DONTWAIT on
the first part, and once that succeeds I can read the whole multipart
atomically without blocking. But that guarantee doesn't seem to be
stated in the docs.
Also, the docs for zmq_msg_recv() say:
An application that processes multi-part messages must use the *ZMQ_RCVMORE*
zmq_getsockopt(3) <http://api.zeromq.org/3-3:zmq_getsockopt> option after
calling *zmq_msg_recv()* to determine if there are further parts to receive.
Wouldn't it be simpler and more efficient to use zmq_msg_more()?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the zeromq-dev