[zeromq-dev] Peer ip address ?

Goswin von Brederlow goswin-v-b at web.de
Wed Jul 9 11:16:40 CEST 2014


On Sun, Jul 06, 2014 at 08:07:17PM -0700, Satish wrote:
> Hi,
> 
> Try using getsocketname. The only problem is that some show the zeromq 
> socket descriptor needs to appear/compatible with a normal socket 
> descriptor.
> 
> Satish
> 
> 
> On Thursday, 16 January 2014 03:14:35 UTC+11, mraptor wrote:
> >
> > hi I was looking for a way to find the peer/client ip address.
> > All of the replies I've seen so far say it is not possible to get the IP 
> > address of the peer in ZeroMQ.
> >
> > The main objection for not providing the IP address seem to be that zeromq 
> > work on top of protocols which may not be TCP/IP.
> >
> > The solution pointed by most of the people seems to be to figure out the 
> > IP address at the client and pass it as a part of the message.
> >
> > I'm currently needing the IP address for logging purposes and in the 
> > future for filtering and routing.
> > Two problems arise :
> >
> > 1. What happens if you don't have access to the client code i.e. it is 
> > written by third party
> > 2. Second allowing the client to provide the IP address could be major 
> > security breach, because if it is up to the client, they can place whatever 
> > IP they want, how would you know ?
> >
> > How do you solve those problems ?  Unless zeromq, already have some means 
> > of getting the peer IP, the discussions about this were from 2011 ?
> >
> > thank you
> >

Or a ZAP handler that stores the IP address of the connection attempt
as User-Id or as metadata. You can then use zmq_msg_gets() to retrieve
it when a message is received.

MfG
	Goswin



More information about the zeromq-dev mailing list