hi,
I want to know how to get name of connected peer.
I am creating a simple client server application using winsock2. When I use getpeername() function it gives me IP of client machine.
After connecting i did following step
sockaddr_in peeraddr;
int size = sizeof(peeraddr);
getpeername(New_Socket, (struct sockaddr *)&peeraddr, &size);
struct sockaddr_in *s = (struct sockaddr_in *)&peeraddr;
char* IP = inet_ntoa(peeraddr.sin_addr);
cout << "Accepted connection from " << Name << "\r\n";