Page 2 of 2

Posted: Thu Feb 07, 2008 9:03 am
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 | Expand

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

Posted: Wed Feb 13, 2008 10:46 am
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

IP

Posted: Wed Feb 13, 2008 10:51 am
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?

Posted: Wed Feb 13, 2008 11:19 am
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

Posted: Wed Feb 13, 2008 1:12 pm
by AlexSchaft
Well, isn't that what oSocket:clientip() gives on the server? It does for me...

Posted: Wed Feb 13, 2008 1:15 pm
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