Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.python
Re: Best practice way to detect internet connectivity under Python 2.6/Windows
Tim Golden
3/8/2010 10:39:00 AM
On 08/03/2010 02:41, python@bdurham.com wrote:
> Is the best pratice way to detect internet connectivity under
> Windows (using Python 2.6) simply to attempt to access a known
> internet website using urllib or urlib2 wrapped in a try/except
> construct?
Well, in theory you could use the Internet API:
http://msdn.microsoft.com/en-us/library/aa383996%28VS....
which is exposed via the win32inet module:
http://timgolden.me.uk/pywin32-docs/win3...
but I'd just do a socket connection to port 80 (or some known port
on some known server) with a reasonable timeout.
TJG
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Best practice way to detect internet connectivity under Python 2.6/Windows
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password