[zeromq-dev] Does zmq_setsockopt(ZMQ_IDENTITY) do anything magical?

Martin Sustrik sustrik at 250bpm.com
Wed Jun 23 13:18:47 CEST 2010


Hi Matt,

> I'm considering changing the Identities of my sockets instead of  
> closing and re-opening them after a REQ/REP protocol failure (where  
> I've received an extra reply via an XREP/XREQ forwarder discussed in  
> the timeout thread).

The identity is applied to particular bind or connect. If you change it 
later on it has no effect.

For example:

s.setsockopt (IDENTITY, "A");
s.connect ("tcp://localhost:5555"); // send "may name is A" to the peer
s.setsockopt (IDENTITY, "B"); // no effect, the peer from the line above 
still treats me as "A"

Martin



More information about the zeromq-dev mailing list