[Tutor] Monitoring an Internet connection in Python
Kent Johnson
kent_johnson at skillsoft.com
Wed Oct 13 23:17:29 CEST 2004
I have a DSL router with a built-in web server. One of the web pages shows
the connection status. It would be pretty simple to write a Python script
to poll the router web page and extract the status.
Kent
At 12:50 PM 10/13/2004 -0700, Terry Carroll wrote:
>My DSL connection is pretty fragile, and tends to drop a lot, and for
>extended periods. I'd like to write a Python program to periodicaly (say,
>every 5 minutes or so) check the status of the Internet connection, and
>log any change in status (detecting when it becomes unavailable and when
>it becomes available again), so I can document the failures to SBC.
>
>What's the best way to check whether my system has a working Internet
>connection using Python? My thinking is to select a few IP addresses
>known to be reliable, and to define "connection available" as being when
>at least one of those sites responds to a ping. Is there a better way?
>
>
>
>_______________________________________________
>Tutor maillist - Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list