I'm using C++ binding for ZMQ (cppzmq) and I'm trying to set the connection timeout of TCP socket using a .setsockopt()
-method like this:
int connectTimeout = 1000;
socket.setsockopt(ZMQ_CONNECT_TIMEOUT, &connectTimeout, sizeof(connectTimeout));
socket.connect(clientConfiguration.uri);
However, I dont see anything (exception thrown?) happening until code reaches actual .send()/.recv()
on the socket. Just to make sure the socket has a chance to throw I put a sleep between .connect()
and .send()
methods.
According to the documentation .zmq_connect()
just enters a READY
-state without making actual connection to the endpoint. So the question is when and how I should experience the connection timeout?
zmq_connect
being asynchronous in the docs. Would you mind pointing me to it? – Whereforezmq_connect
behaves differently here api.zeromq.org/4-2:zmq-connect? – Cateyed