[zeromq-dev] Unreasonable behavior of a socket when connection can't be established. How to enable the blocking mode on a socket?

Jake jake.cobb at gmail.com
Fri Sep 30 08:26:36 CET 2022


Set ZMQ_SNDTIMEO and ZMQ_RCVTIMEO to have the send/recv fail eventually.
Also see ZMQ_LINGER for socket shutdown behavior.

IIRC, for REQ/REP there is an internal state machine that demands they
alternate, so after a failure you may need to reconstruct the socket to
continue as the two sides may not be in sync on the alternation.

-Jake



On Fri, Sep 30, 2022 at 3:09 AM Yuri <yuri at rawbw.com> wrote:

> On 9/28/22 07:20, Bill Torpey wrote:
>
>
> 1.   You can set options on the socket to change ZMQ’s default
> reconnection algorithm:
>
> ZMQ_RECONNECT_STOP_CONN_REFUSED
> ZMQ_RECONNECT_STOP_HANDSHAKE_FAILED
> ZMQ_RECONNECT_STOP_AFTER_DISCONNECT
>
>
> I tried to set the first option on the REQ socket:
>
> > setsockopt(zmq.RECONNECT_STOP, 1) # zmq.RECONNECT_STOP_CONN_REFUSED
>
> but it still doesn't fail on 'Connection Refused' event.
>
>
> Yuri
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20220930/2fd784ea/attachment.htm>


More information about the zeromq-dev mailing list