This would be cleaner, yes. I'm not competent to do that though :-)


On Thu, Jun 27, 2013 at 11:02 PM, Martin Hurton <notifications@github.com>wrote:

> In doc/zmq_socket.txt:
>
> > +^^^^^^^^^^
> > +A socket of type 'ZMQ_STREAM' is used to send and receive TCP data from a
> > +non-0MQ peer, when using the tcp:// transport. A 'ZMQ_STREAM' socket can
> > +act as client and/or server, sending and/or receiving TCP data asynchronously.
> > +
> > +When receiving TCP data, a 'ZMQ_STREAM' socket shall prepend a message part
> > +containing the _identity_ of the originating peer to the message before passing
> > +it to the application. Messages received are fair-queued from among all
> > +connected peers.
> > +
> > +When sending TCP data, a 'ZMQ_STREAM' socket shall remove the first part of the
> > +message and use it to determine the _identity_ of the peer the message shall be
> > +routed to, and unroutable messages shall cause an EHOSTUNREACH or EAGAIN error.
> > +
> > +To open a connection to a server, use the zmq_connect call, and then fetch the
> > +socket identity using the ZMQ_IDENTITY zmq_getsockopt call.
>
> What about sending an empty frame (prefixed by identity frame) when a new
> connection is set up. This would work with connect and bind sockets. So
> when you receive an empty frame, we know the identity of the peer. When we
> send an empty frame, we close the connection.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/zeromq/libzmq/pull/593/files#r4926646>
> .
>