Mega Search
23.2 Million


Sign Up

Make a donation  
IdTCPServer: PeerIP not set?  
News Group: embarcadero.public.delphi.internet.winsock

When I access the Context.Binding.PeerIP for an existing Client connection on the IdTCPServer, the PeerIP shows as 0:0:0:0:0:0:0:1.
It is a normal IPV4 connection on the localhost.

Why can I not get the actual PeerIP?

Bart


--
Bart Kindt, CEO and developer
SARTrack Limited New Zealand
http://www.sartrack.co.nz/

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 3-Dec-2014, at 8:53 PM EST
From: Bart Kindt
 
Re: IdTCPServer: PeerIP not set?  
News Group: embarcadero.public.delphi.internet.winsock
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}

Ah yes. I forced the IPVersion to IPV4, and now it reports the correct IP address.

Thanks Remy.

> It is not possible for an IPv4 client to report an IPv6 address.  Check the 
> Binding.IPVersion property, it would have to be Id_IPv6 for Binding.PeerIP 
> to report an IPv6 address.  And remember that if you do not configure any 
> Bindings when activating the server, it creates default bindings for both 
> IPv4 and IPv6 on systems that support IPv6.  So your client is likely actually 
> connecting using IPv6 instead of IPv4.

--
Bart Kindt, CEO and developer
SARTrack Limited New Zealand
http://www.sartrack.co.nz/

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 4-Dec-2014, at 11:33 AM EST
From: Bart Kindt
 
Re: IdTCPServer: PeerIP not set?  
News Group: embarcadero.public.delphi.internet.winsock
Bart wrote:

> When I access the Context.Binding.PeerIP for an existing Client
> connection on the IdTCPServer, the PeerIP shows as 0:0:0:0:0:0:0:1.

That is the IPv6 "localhost" address, equivilent to IPv4's 127.0.0.1 address.

> It is a normal IPV4 connection on the localhost.

It is not possible for an IPv4 client to report an IPv6 address.  Check the 
Binding.IPVersion property, it would have to be Id_IPv6 for Binding.PeerIP 
to report an IPv6 address.  And remember that if you do not configure any 
Bindings when activating the server, it creates default bindings for both 
IPv4 and IPv6 on systems that support IPv6.  So your client is likely actually 
connecting using IPv6 instead of IPv4.

> Why can I not get the actual PeerIP?

You are getting the actual IP address.  That is the actual IP address being 
reported by the underlying socket after it has been accepted by the server.

--
Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 4-Dec-2014, at 10:28 AM EST
From: Remy Lebeau (TeamB)