[zeromq-dev] How to read client's IP address from zmqsocket using tcp

Maciej Gajewski Maciej.Gajewski at tibra.com
Thu Jun 16 10:36:54 CEST 2011

But still it would be possible (and very usefull) to get address of origin of received message. Or - in case of ROUTER socket - have a mechanism that would translate the sender identity in the first message part into actual source address.

This is one of the limitations of 0MQ I encountered in a project I'm working on: I'm not able to tell from what machine the request originated. It could be done on application level, but I: it adds extra complexity to the protocol on app level and II: client does not always known it's public IP address (or can not obtain this information in easy, portable way). And the router socket has all the data I need, there is only now way of extracting it.

-----Original Message-----
From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Martin Sustrik
Sent: Thursday, June 16, 2011 9:28 AM
To: ZeroMQ development list
Cc: Helge Früh
Subject: Re: [zeromq-dev] How to read client's IP address from zmqsocket using tcp

Hi Helge,

> I wonder if it's possible to read the client's IP address from a
> zmqsocket which is connected through tcp.  I know that the server socket
> generates an abstract SenderId if the client doesn't use an explicit
> identity. But this seems to be rather some type of GUID. I know that I
> could make the client's IP address an explicit part of the message but I
> would rather read the IP address of some kind of metadata that the
> socket generates...

No there's no way to find out. Given that each 0MQ socket can have 0 to
N underlying TCP or non-TCP connections, it doesn't even make much sense.

zeromq-dev mailing list
zeromq-dev at lists.zeromq.org

Tibra Trading Europe Limited is Authorised and Regulated by the FSA (Company No. 06061713)
Tibra Global Services Pty Limited London Branch (Company No. BR014370)
Tibra Equities Europe Limited (Company No. 07283912)
Registered in England & Wales - Level 11, 5 Aldermanbury Square London EC2V 7HR

The contents of this email including any attachments are confidential.  If you have received this email in error, please advise the sender by return email and delete this email.  Any unauthorised use of the contents of the email is prohibited and you must not disseminate, copy or distribute the message or use the information contained in the email or its attachments in any way.

The views or opinions expressed are the author's own and may not reflect the views or opinions of Tibra. Tibra does not guarantee the integrity of any emails or attached files. E-mails may be interfered with, may contain computer viruses or other defects. Under no circumstances do we accept liability for any loss or damage which may result from your receipt of this message or any attachments.

More information about the zeromq-dev mailing list