[zeromq-dev] Blocking when receiving multipart messages
luca.boccassi at gmail.com
Wed Aug 8 12:17:48 CEST 2018
On Wed, 2018-08-08 at 10:58 +0100, Al Grant wrote:
> I'm receiving multipart messages on a SUB socket and I want to make
> 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
> immediately read the next part?
> If I can rely on that guarantee then I only need to use ZMQ_DONTWAIT
> 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.
Yes, messages are either delivered with all their parts to the
application receive queue or not at all.
> Also, the docs for zmq_msg_recv() say:
> An application that processes multi-part messages must use the
> zmq_getsockopt(3) <http://api.zeromq.org/3-3:zmq_getsockopt> option
> calling *zmq_msg_recv()* to determine if there are further parts to
> Wouldn't it be simpler and more efficient to use zmq_msg_more()?
You can use either, they do the same thing.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 488 bytes
Desc: This is a digitally signed message part
More information about the zeromq-dev