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
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
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
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()
Alternatively, you can call getpeername() followed by gethostbyname()
thanks.