I\'m looking to obtain my own IP address in order to publish that information in to a Peer-to-Peer network. In POSIX/C we have getaddrinfo(NULL, ...)
, but this
Create a UDP socket, bind() to INADDR_ANY, connect() to some address on the internet, then use getsockname() on the socket to find out what address it was assigned.
Another good solution, if the network's protocol supports it, is to just ask your bootstrapping peers what they think your IP is. This takes care of NATs automatically.