[zeromq-dev] Socket connect status

Martin Sustrik sustrik at 250bpm.com
Tue Mar 16 11:29:02 CET 2010

Hi Andreas,

>  > Anyway, the problem we are discussing here is whether there exists sync
>  > API for 0MQ. One that handles at most 1 TCP connection, implements no
>  > queueing, and is able to connect but not to bind, returns TCP errors
>  > directly to the user.
> I need asynchronous communication in almost every case. Only in some special
> cases I have to close the socket as soon as possible. In these cases I 
> must have
> at least the possibility to ask if a socket can be closed, i.e. if all 
> messages are
> successfully sent. I benefit from the asynchronism in all other cases.

Ok. Fair enough. I believe more people are struggling with the same 
problem. What about writing a simple sync API implementation?

s = zmq_sync_socket (ZMQ_SUB, "tcp://localhost:5555");
zmq_sync_send (s, &msg);
zmq_sync_recv (s, &msg);

The implementation would be pretty trivial. The only thing needed is to 
prepend frame header to each message sent and remove the frame header 
from each message received. For desctiption of the wire format, have a 
look here:



More information about the zeromq-dev mailing list