[zeromq-dev] zeromq 2.0 - req/rep model - knowing the remote client address

Martin Sustrik sustrik at 250bpm.com
Thu Dec 17 15:14:29 CET 2009


Hi Matias,

> Still playing with zeromq 2.0, in Python this time !
> 
> I would like to know : is it possible to get the remote client address,
> or at least something I could use to identify a client, using the req/rep
> model ?
> 
> I mean, if I start a server socket with libpyzmq.REP and I start
> processing incoming requests from clients (using libpyzmq.REQ sockets
> on the other side), how can I know from which client a request
> is coming on the server, if I have several clients ?
> I thought about transmitting a kind of identifier in each request,
> but I would like a better solution.
> 
> I looked at the available methods in the Socket object but I didn't
> see anything useful for this purpose.
> 
> Is there a list of clients / a dictionary / something in the Context or
> any other object ?

At the moment the clients are more or less anonymous. What I am working 
on right now is enhanced req/rep mechanism where each request would hold 
  the whole path it traversed, so that the reply can follow the same 
path in the opposite direction.

In theory it's possible to make the path available via API (say 
zmq_getsockopt). It would look something like this: 
"MIDDLEBOX2|MIDDLEBOX1|MY_CLIENT_APPLICATION|"

Still, the question is why would the server application need to know 
client's identity and whether it is really an information that should be 
handled on 0MQ level rather than on the application level.

Martin



More information about the zeromq-dev mailing list