Q: In win32asm, how would you get the IP address of a client connecting to your server program? I have tried doing inet_ntoa(sin.sin_addr) where sin is sin sockaddr_in<> and sin.sin_addr.S_un.S_addr=INADDR_ANY. It is supposed to work, because this is what I do in C++, but it didn't return the client's IP. Any help is appreciated. This message was edited by clip, on 6/2/2001 6:22:34 AM
Posted on 2001-06-02 06:19:00 by clip
you could just just get the IP on the client side and send it to the server ... this isnt a very direct way of achieving the result but it will work ;) skud This message was edited by skud, on 6/2/2001 4:23:43 PM
Posted on 2001-06-02 15:57:00 by skud
Thanks for the reply skud, but that could be spoofed pretty easy :) security is one of my primary concern in a netapp (switch to linux?). in terms of reliability, you really can't rely on the whole TCP/IP itself (as if we have a choice :)) but the way I want to find the client's IP is the most simple best bet. Plus I had it working on C/C++. - clip
Posted on 2001-06-02 19:21:00 by clip
to get info about the client connecting to your server, you must analise the structure sockaddr you pass as 2nd parameter to accept() it is filled with info about the computer is connecting to you... same with WSAaccept()
Posted on 2001-06-02 20:27:00 by vecna
Alternatively, you can call getpeername() followed by gethostbyname()
Posted on 2001-06-03 00:12:00 by Iczelion
Posted on 2001-06-03 03:56:00 by clip