Thanks for you reply.
I need to reset the sockets periodically because setting no timeouts on them 
ends up in a REQ/REP deadlock where:

  *   PeerA sends a message
  *   PeerB receives it and sends a  ACK message
  *   PeerA never receives the ACK
  *   PeerB is waiting for the next message to arrive because the (REP) reply 
is not blocking

>From what I can see with wireshark the following sequence happens in a loop:

  *   [SYN], PeerB -> PeerA
  *   [RST,ACK], PeerA -> PeerB
  *   [TCP Retransmission], PeerB -> PeerA
  *   [RST,ACK], PeerA -> PeerB
  *   [TCP Retransmission], PeerB -> PeerA
  *   [RST,ACK], PeerA -> PeerB


De : Francesco<>
Envoyé le :Saturday, April 7, 2018 11:06 AM
À : ZeroMQ development list<>
Objet :Re: [zeromq-dev] [REP-REQ] Sockets timeouts and connection reset

Hi Victor,

2018-04-06 17:44 GMT+02:00 DUMAS, Victor 
In order to not block forever each socket has sending and receiving timeouts. 
In case those timeouts are reached the sockets are destroyed and recreated.

this statement has triggered my attention: why would you do that ?
ZMQ sockets are meant to be long-lived objects from my understanding and if 
something bad happens at networking level (somebody pulls off the cable) they 
will automatically reconnect using ZMQ background threads once network 
connectivity is restored... I think that in your scenario destroying the 
sockets and recreating them is not really needed and does not really help: just 
keep retrying or (if you're using TCP transport and you have timeouts big 
enough) you can simply provide an error message of some kind (e.g. network 

Just my 2 cents,

Click here<> to report 
this email as spam.

This message has been scanned for malware by Websense.
zeromq-dev mailing list

Reply via email to