Checking if the computer is online
Mickel Grönroos
mickel at csc.fi
Wed Sep 24 08:21:29 EDT 2003
On Wed, 24 Sep 2003, Pierre Quentel wrote:
> Have you tried :
> socket.gethostbyname(socket.gethostname())
> or
> socket.gethostbyname_ex(socket.getfqdn())[2]
>
> Normally the result should be different if you're connected or not
Thanks for the tip! I tried this and the second line freezes execution
when I have unplugged my Ethernet cable. So again, I need a timeout on my
socket. This is not available in Python 2.2.2. I reckon I need to try
Python 2.3.
/Mickel G
More information about the Python-list
mailing list