F
Frank Miles
Hi everyone...
I'm trying to use the IP address as a way of detecting the current state
of my laptop. [Using laptop-net, it senses what network it's connected
to, and configures various parameters including IP address. This seems
to work properly, as reflected in the `ifconfig` output.]
Unfortunately while the simple script:
import socket
print socket.gethostbyname(socket.gethostname())
works on my desktop machines and server, on the laptop it gives:
127.0.0.1
which, of course, doesn't provide any idea as to the state of the network.
Is there any way to coerce the external IP#? Or another way of accessing
this number?
TIA for any tips or pointers to relevant docs!
-frank
--
I'm trying to use the IP address as a way of detecting the current state
of my laptop. [Using laptop-net, it senses what network it's connected
to, and configures various parameters including IP address. This seems
to work properly, as reflected in the `ifconfig` output.]
Unfortunately while the simple script:
import socket
print socket.gethostbyname(socket.gethostname())
works on my desktop machines and server, on the laptop it gives:
127.0.0.1
which, of course, doesn't provide any idea as to the state of the network.
Is there any way to coerce the external IP#? Or another way of accessing
this number?
TIA for any tips or pointers to relevant docs!
-frank
--