Prev: The C language like the Python, by the Python and for the Python--- PythoidC
Next: Curiosity stirkes me on 'import this'.
From: Tim Golden on 8 Mar 2010 05:38
On 08/03/2010 02:41, python(a)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
Well, in theory you could use the Internet API:
which is exposed via the win32inet module:
but I'd just do a socket connection to port 80 (or some known port
on some known server) with a reasonable timeout.