swc-setup-get-my-ip.git
10 years agoget-my-ip.py: Python 2.x sockets can't be used in 'with' statements
W. Trevor King [Tue, 19 Feb 2013 02:56:16 +0000 (21:56 -0500)]
get-my-ip.py: Python 2.x sockets can't be used in 'with' statements

They don't have __exit__.  Use an explicit try/except block to be
compatible with both 2.x and 3.x.

10 years agoget-my-ip.py: Add a script for getting your public IP address
W. Trevor King [Tue, 19 Feb 2013 02:52:13 +0000 (21:52 -0500)]
get-my-ip.py: Add a script for getting your public IP address

This will help students connect to each other on the LAN during class.
Note that if you ping a host across a NAT, you'll get your IP inside
the NAT, not the NAT's IP.