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

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

2011/5/23 Fabien Niñoles <fabien.ninoles at gmail.com>:
> 2011/5/23 Pieter Hintjens <ph at imatix.com>:
>> Interesting stuff. Would it perhaps be better to use SO_RCVTIMEO and

Not sure I like what I read from the Windows side

    When using the recv function, if no data arrives during the period
specified in SO_RCVTIMEO, the recv function completes. In Windows
versions prior to Windows 2000, any data received subsequently fails
with WSAETIMEDOUT. In Windows 2000 and later, if no data arrives
within the period specified in SO_RCVTIMEO, the recv function returns
WSAETIMEDOUT, and if data is received, recv returns SUCCESS.

    If a send or receive operation times out on a socket, the socket
state is indeterminate, and should not be used; TCP sockets in this
state have a potential for data loss, since the operation could be
canceled at the same moment the operation was to be completed.

I, personnaly, prefer the linux behavior (return EAGAIN, just like a
non-blocking call would do) than the Windows behavior (scrap my socket
entirely).  I would probably leave the Windows implementation as is
and check on the linux side.


More information about the zeromq-dev mailing list