[zeromq-dev] ZMQ router-dealer set-up: can old socket identities be recycled? ("inproc")

Kah-Chan Low kahchanlow at yahoo.com
Mon Nov 12 14:24:39 CET 2012

I am using the router(server)--dealer(client) set-up in C++.  In my application, an existing dealer(client) connection may be disconnected from the router any time and the socket deallocated.  Similarly new dealers may be created and connect to the router at any time.  Each dealer is contained inside an object and I cast the object pointer into a string and set that as the dealer's identity.  During the course of execution new objects are continually created and old objects deleted.  As a result, it is possible to get a new object with the same object pointer value as one that has been recently deleted.  From time to time I would discover that messages sent by a dealer of a newly allocated object were getting lost; and this invariably happened when the new object has the same pointer value as an object that had been recently deallocated.  I then switched to a naming scheme that avoided recycling old socket identity names and the problem went
 away!  So it looks like the router has memory of identities of disconnected socket.  Is this intended.  My application is supposed to run for months and that means I have to use increasing long strings to ensure identity uniqueness.  Won't this have an impact on performance?
BTW, I am using "inproc" protocol.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20121112/ab4cc047/attachment.htm>

More information about the zeromq-dev mailing list