how to look up you local machine’s external IP address (not 127.0.0.1)
I needed to write some code to find out my local machine’s IP address. I wanted to tell another machine my IP address so that other machine could open a socket connection back to my machine. A little googling turned up some sample code which works on both Linux and Mac OS X. Also I fiddled around with that code and condensed it down a bit.