[zeromq-dev] [PATCH] Add ZMQ_TIMEOUT sockopt.

Fabien Niñoles fabien.ninoles at gmail.com
Mon May 23 21:56:36 CEST 2011

2011/5/23 Pieter Hintjens <ph at imatix.com>:
> 2011/5/23 Fabien Niñoles <fabien.ninoles at gmail.com>:
>> Right now, no.  It a loop quite similar to the one used in zmq_poll
>> IIRC.  With RCVTIMEO/SNDTIMEO, it would be very different however, and
>> I couldn't used it in the Windows implementation because of the crappy
>> behavior.(but whatever, I already write the code down, so no trouble
>> here).
> From reading the patch, surely you just s/timeout/rcvtimeou/?
> I didn't see where you're doing timeouts on send.

No, basically, the code in socket_base_t::send/recv deal with the
blocking/non-blocking issue around the process_command call, which
itself call mailbox_t::recv with the appropriate option (block_ and
timeout).  So, the ZMQ options would be selected depending if you call
the process_command from the send or the recv functions of
socket_base_t, and would be used inside the mailbox_t::recv method to
correctly timeout in blocking call.

The active loop would probably be no more required, although I should
ensure the code exit cleanly in blocking mode with timeout (instead of
looping again).


More information about the zeromq-dev mailing list