determining network connection status

Eric Peden ericpeden at homemail.com
Wed Jul 30 14:10:00 EDT 2003


I'm building a stack that will ultimately submit data supplied by the
user to a server, but that allows them to enter their data offline. If
the user is offline when they try to submit this data, I would like to
display an error message reminding them to connect first before
submitting their information. What's the best way to determine if they
have a working network connection?

Currently, I simply "get URL" a page on our web server and, if the result
is empty, show the "not connected" message. However, this has a couple
of problems:

1) There's often a significant timeout delay when the network is
   unavailable, sometimes 10 or 15 seconds. I'd like to let the user know
   more quickly what the problem is.

2) I can't distinguish between a "no network" error and a timeout error.
   Ideally, I'd let the user know the problem is not their fault if I
   get a timeout, but since I'm also relying on a timeout to tell me if
   the network is not available, I can't provide a specific error
   message.

I could fix (1) by opening a socket with a shorter timeout value, but
that still doesn't address (2). Any ideas?

-- 
eric



More information about the use-livecode mailing list