REQ-REP is intentionally very strict. The REQ socket will round-robin among all endpoints.
Given an internal pipe is created immediately and synchronously by the
library when you call zmq_connect, it will block if the other end is not
connected yet.
To override this behaviour, set the ZMQ_IMMEDIATE socket option before
the connect() calls. This will result in the unconnected endpoints being
"ignored" until they are connected.
socket.setsockopt(zmq.IMMEDIATE, 1)
On Sat, 2016-12-31 at 14:29 +0100, D.A. Vaughn wrote:
> In the example below taken from Nicholas Piel's ZMQ tutorial, a client
> makes connections to socket 5000 and 6000. My question is, suppose
> there are two separate servers, one that handles port 5000 messages
> and one that handles 6000?
>
> What happens if the server listening to port 5000 is down? It appears
> to me this client below is blocked even though one of its servers is
> available.
>
> Regards
>
> David
>
> import zmq
> context = zmq.Context()
> socket = context.socket(zmq.REQ)
> socket.connect("tcp://127.0.0.1:5000")
> socket.connect("tcp://127.0.0.1:6000")
>
> for i in range(10):
> msg = "msg %s" % i
> socket.send(msg)
> print "Sending", msg
> msg_in = socket.recv()
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
signature.asc
Description: This is a digitally signed message part
_______________________________________________ zeromq-dev mailing list [email protected] https://lists.zeromq.org/mailman/listinfo/zeromq-dev
