Remote IP

User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Post by AlexSchaft »

SylRob wrote:Alex,

I'm really familiar with the socket function ! :). This won't work if the client connection come from the internet over a Router you'll obtain the ROUTER IP !

Best Regards,

Sylvain
I have used sockets over routers before, and have never had an issue with only getting the router ip....

Below over vpn

Code: Select all

D:\Dev>ipconfig

Windows IP Configuration

PPP adapter AST:

        Connection-specific DNS Suffix  . :
        IP Address. . . . . . . . . . . . : 172.21.129.146
        Subnet Mask . . . . . . . . . . . : 255.255.255.255
        Default Gateway . . . . . . . . . :

D:\Dev>tracert -d 172.21.141.190

Tracing route to 172.21.141.190 over a maximum of 30 hops

  1   394 ms   307 ms   373 ms  172.21.129.128
  2     *      276 ms   544 ms  172.21.128.2
  3   687 ms   841 ms   467 ms  172.21.135.6
  4   588 ms   294 ms   752 ms  172.21.141.190

Trace complete.

D:\Dev>telnet 172.21.141.190 4040

Welcome listener from 172.21.129.146
SylRob
Posts: 15
Joined: Thu Nov 01, 2007 4:54 pm

Post by SylRob »

Alex,

The problem wasn't getting my OWN IP, the problem is getting the IP from a client connected to a TCP/IP server that I wrote when the server is behind a ROUTER !

Best Regards,

Sylvain
Sylvain Robert
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

IP

Post by AlexSchaft »

So you want to get the IP Address from Client A, connected to server B, while you are at client C, connecting to B?

Can't server B keep a record of who's connected?
SylRob
Posts: 15
Joined: Thu Nov 01, 2007 4:54 pm

Post by SylRob »

simpler than that, I just want the IP adress of the client that his connected to the current socket descriptor of my TCP/IP server when behind a ROUTER.

Best,

Sylvain
Sylvain Robert
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Post by AlexSchaft »

Well, isn't that what oSocket:clientip() gives on the server? It does for me...
SylRob
Posts: 15
Joined: Thu Nov 01, 2007 4:54 pm

Post by SylRob »

Alex,

It won't if your server is behind the ROUTER and the client connect to your server from the WAN you'll receive the ROUTER IP not the client IP

Best,

Sylvain
Sylvain Robert
Post Reply