How can I extract an IP address into a string? I can't find a reference that tells me how char sa_data[14]
is encoded.
Just cast the entire sockaddr
structure to a sockaddr_in. Then you can use:
char *ip = inet_ntoa(their_addr.sin_addr)
To retrieve the standard ip representation.