[zeromq-dev] [PULL] x317: implement zmq_unbind(), zmq_disconnect(), zmq->sock->getsockopt(ZMQ_LAST_ENDPOINT_ID)

Sergey Hripchenko shripchenko at intermedia.net
Wed Apr 18 22:22:28 CEST 2012

Please review and approve.

The usage scheme:

After EACH successful call to sock->bind() or sock->connect() you can call
sock->getsockopt(ZMQ_LAST_ENDPOINT) to obtain resolved endpoint address string and
sock->getsockopt(ZMQ_LAST_ENDPOINT_ID) to obtain 'void *' endpoint handle.

Later on you can call sock->unbind() or sock->disconnect() with saved endpoint handle to terminate endpoint.
(Of course if we want to do it right we need to change sock->bind() and sock->connect() to return endpoint handle if succeeded, but API change is almost impossible...)

Current implementation cons/incompatibilities (and potential improvements):
* doesn't work with 'inproc' transport(just unset ZMQLAST_ENDPOINT and ZMQ_LAST_ENDPOINT_ID after every call to bind(inproc://) or connect(inproc://). I just don't know how it works :(
* no specific error code/confirmation that endpoint handle passed to unbind()/disconnect() is actually valid and terminated. Easily could be implemented if needed.
* ZMQ_LAST_ENDPOINT changed more often than before(after _EACH successful call to bind()/connect() )
* *address_t->to_string() hierarchy could be improved.


This message is intended only for the person(s) to which it is addressed and may contain Intermedia.net Inc privileged, confidential and/or proprietary information. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Any disclosure, copying, distribution, or the taking of any action concerning the contents of this message and any attachment(s) by anyone other than the named recipient(s) is strictly prohibited.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120418/a125143a/attachment.htm>

More information about the zeromq-dev mailing list