Take a look at the setsockopt() call:

ZMQ_IDENTITY: Set socket identity

The ZMQ_IDENTITY option shall set the identity of the specified socket when connecting to a ROUTER socket. The identity should be from 1 to 255 bytes long and may contain any values.

If two clients use the same identity when connecting to a ROUTER, the results shall depend on the ZMQ_ROUTER_HANDOVER option setting. If that is not set (or set to the default of zero), the ROUTER socket shall reject clients trying to connect with an already-used identity. If that option is set to 1, the ROUTER socket shall hand-over the connection to the new client and disconnect the existing one.
Option value typebinary data
Option value unitN/A
Default valueNULL
Applicable socket typesZMQ_REQ, ZMQ_REP, ZMQ_ROUTER, ZMQ_DEALER.

On Fri, Aug 24, 2018 at 2:28 PM, Sam Stein <sam.stein@tempustechnologies.com> wrote:

The documentation for a ROUTER socket says: “When receiving messages a ZMQ_ROUTER socket shall prepend a message part containing the identity of the originating peer to the message before passing it to the application.”


When our bound endpoint goes down, it drops currently pending requests to a text file.





Hello world



When we boot a new one, it can read these files, but it can’t identify the client in question because the identifier was unique to the previous socket. It has no concept of who this “008000002D” client is (or sends it to a new client it has identified with this tag).


The question is, can we force a ROUTER socket to use a unique identity provided by the client instead of making one up on its own?


Thank you,


Sam Stein

Software Developer


Tempus Technologies, Inc.


zeromq-dev mailing list