[zeromq-dev] zmq_poll question.

Riskybiz riskybizlive at live.com
Wed Mar 11 13:09:23 CET 2015


If I an application uses zmq_poll() before sending or receiving messages to
check socket(s) for these events;

 

ZMQ_POLLIN

For ØMQ sockets, at least one message may be received from the socket
without blocking. For standard sockets this is equivalent to the POLLIN flag
of the poll()system call and generally means that at least one byte of data
may be read fromfd without blocking.

ZMQ_POLLOUT

For ØMQ sockets, at least one message may be sent to the socket without
blocking. For standard sockets this is equivalent to the POLLOUT flag of the
poll()system call and generally means that at least one byte of data may be
written tofd without blocking.

Does it imply that a check has been made which will ensure that the HWM
(high water mark) of a sending or receiving socket will not be exceeded?

 

So that for example;

Consider a DEALER-ROUTER connection where the ZMQ_ROUTER has reached a mute
state and is dropping messages.  Is it the case that by checking for
ZMQ_POLLOUT on the ZMQ_DEALER before sending to the ZMQ_ROUTER that it would
prevent a message from being sent and consequently dropped by the
ZMQ_ROUTER.

 

  Additionally the ZMQ_ROUTER could be set up using zmq_poll() to check for
ZMQ_POLLIN & ZMQ_POLLOUT which would prevent exceeding its HWM by not
accepting further inbound messages when in the mute state; so that whilst
the socket may be full to the HWM it will not drop any messages?

 

 

When considering the zeromq api entry for zmq_poll()
<http://api.zeromq.org/4-1:zmq-poll>  I see that;

ZMQ_POLLIN For ØMQ sockets, at least one message may be received from the
socket without blocking.

ZMQ_POLLOUT For ØMQ sockets, at least one message may be sent to the socket
without blocking.

 

May I ask, how does this relate to multi-part messages?  Is it that a single
zmq_msg_t message frame could be sent or received? Would an single entire
multi-part message be OK?  I intend to be using the ‘clone’ pattern and it
could be the case that a single very large multi-part message carrying the
‘state’ could be the next to be sent.

 

I would like to minimise the possibility that my code could cause messages
to get dropped by considering the implications of acting to send & receive
only on satisfactory poll events?

 

Any elaboration on these subjects is much appreciated.

 

With thanks,

 

Riskybiz.

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150311/f22d1f5b/attachment.htm>


More information about the zeromq-dev mailing list