Everything is as it should. The advantage (depending on how you look at it, of course) of ZeroMq is that you do not need to connect after starting the server, and also means that it connects normally, even if the connection to the server is temporarily disconnected. ZeroMq will maintain a connection (query) and try again.
Api docs for zmq_connect () state that:
For most modes of transport and sockets, the connection is not made immediately, but if necessary via ØMQ. Thus, a successful call to zmq_connect () does not mean that the connection was or could be established. Because of this, for most types of transport and sockets, the order in which the server socket is attached and the client socket is connected to it does not matter. The first exception is when using the inproc: //: transport, you must call zmq_bind () before calling zmq_connect (). The second exception is ZMQ_PAIR sockets, which do not automatically connect to endpoints.
As you can see from the documentation, there is no error code for the non-responder / existing endpoint. Basically, as long as you provide a valid endpoint (and you, for example, do not fall into the socket limit for a process), you should be good.
source share