Advertisement

Determine Internet IP from Socket :: Winsock

Started by June 04, 2002 04:34 PM
1 comment, last by kuphryn 22 years, 7 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
getpeername()inet_ntoa() 
daerid@gmail.com
Advertisement
Thanks.

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

Kuphryn

This topic is closed to new replies.

Advertisement