Determine Internet IP from Socket :: Winsock

Started by
1 comment, last by kuphryn 21 years, 10 months ago
Hi. Given an active socket, what is the best way to determine the IP property of that socket? For example, let say I have an ftp server. When a connection is made with a client and the socket for that client is active, how do you determine the client''s IP address? My initial idea right now is to us getpeername(), which returns the socket''s sockaddr. Once you have a pointer to a sockaddr structure, you then determine the IP using getnameinfo(). Thanks, Kuphryn
Advertisement
getpeername()inet_ntoa() 
daerid@gmail.com
Thanks.

I implement the solution using getpeername() and getnameinfo().

Kuphryn

This topic is closed to new replies.

Advertisement