C++ / Network / Programming

Getting socket info from a socket descriptor

This is one of the most common questions: given a socket descriptor, how can I tell the socket info (that is, IP and port) of the socket?
Well, since there are two types of networks (IPV4 and IPV6) you might want to deal with both of them. more than that, lets assume we want it wrap in a std::string:

Leave a Reply

Your email address will not be published. Required fields are marked *