checking an ip

Peter Schneider-Kamp peter at schneider-kamp.de
Wed Sep 13 10:56:05 EDT 2000


You could do this with the signal module (as proposed by someone),
but you really want to have timeoutsocket.py (look in the archives).

Peter

Ian Weeks schrieb:
> 
> I would like to know how to see if a certain IP is active. I want to login
> using the ftplib module, but when the given IP number does not exist, it
> just hangs, or waits for a long time to timeout. Ping has the same problem.
> So what I need is a way to say:
> 
> # Some pseudo code
> ftp = FTP('xxx.xxx.xxx.xxx', timeout='3')
> 
> so, if the connection isn't established in 3 seconds, an exception is
> raised, or ftp gets value 0.
> 
> I guess there is a way to do this, but how? Can anyone help me out?
> 
> Ian Weeks
> 
> --
> Linux is like a wigwam... no windows, no gates, and apache inside
> 
> --
> http://www.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list