Search code examples
cipclientwinsock

How can I get the connected client's IP address using WinSock2 and C?


I want to get the IP address of the client who’s just connected into my server running WinSock2. I’m using C.


Solution

  • Have not done it myself, but take a look at getpeername. Looks like this is what you need.