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 > 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' > indication > 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 > message > atomically without blocking. But that guarantee doesn't seem to be > explicitly > 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_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()? > > Al You can use either, they do the same thing. -- Kind regards, Luca Boccassi
signature.asc
Description: This is a digitally signed message part
_______________________________________________ zeromq-dev mailing list [email protected] https://lists.zeromq.org/mailman/listinfo/zeromq-dev
