Determining if a client PC has an Internet connection

Tuure Laurinolli tuure at laurinolli.net
Sun Sep 19 22:54:36 CEST 2004


Cliff Wells wrote:

> I'm writing an application that needs to know if an Internet connection
> is available.  Basically, I want to have something similar to what a lot
> of email clients have, where the app can work either in "online" or
> "offline" mode (it keeps a cache of downloaded info, so it can work
> without a connection if needed).

I do not see why there would have to be specific online and offline 
modes. They are annoying. Especially when they educatedly guess they are 
not on the Internet and refuse to believe the user who says they are.

> The basic problem is this: it downloads info (RSS feeds) from a variety
> of sources.  Any one (or more) of these could conceivably fail to
> download, so simply waiting for a timeout isn't sufficient (not easy to
> differentiate between having a bad server and the client not having a
> connection).  Further, if it waits (say 30s) for the timeout to occur,
> this is going to be a bit annoying to the user.

So why not assume you are always connected to the Internet. Download 
updated info into local cache whenever possible and always show local 
cached information. Of course you could somehow indicate the age of the 
cached information, so the user doesn't think that local cached 
information is up-to-date when it actually isn't.



More information about the Python-list mailing list