On 26/01/2012, at 12:32 PM, john skaller wrote: > > Isn't it also a design fault? I mean, if you can connect/bind to multiple > endpoints dynamically > you obviously should be able to un-connect and un-bind.
API: int disconnect(void *socket, void *connection); int unbind(void *socket, void *connection); Semantics: When you connect or bind a socket, 0MQ associates the char* address of the endpoint name with the internal representation of the endpoint. When you call disconnect or unbind, ALL the endpoints which are associated with that address are detached from the socket. 0MQ does not use the address for anything so it is perfectly safe to free the buffer. It is also safe to use the same buffer for two connections, in fact this is useful if you wish to disconnect or unbind them together. if want to distinguish end points ensure the addresses passed in are unique (i.e. if you're using wildcard connections make sure to copy the buffer if you want to distinguish them). No change to the existing C API is required for this extension. No code is broken by this extension. I guess the association of the address with the endpoint internally is easy enough? The exact method of disconnecting is open, but would be a bit similar to doing a close. disconnecting all sockets does NOT relieve the client of the need to close the socket. I am guessing the disconnect would block in the same circumstances as close would. The return value is -1 on error, or the number of endpoints disconnected or unbound. 0 is a valid result. I do not know what errors might occur .. except perhaps trying to unbind a connection or disconnect a binding. -- john skaller [email protected] _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
