testing for Internet connection
Alex Tweedly
alex at tweedly.net
Sun Dec 19 07:04:14 EST 2004
At 02:01 19/12/2004 -0800, Chipp Walters wrote:
>Hi Richard,
>
>I've found this to work well:
>
>function isConnectedToInternet pURL
> if pURL is empty then put "http://www.google.com" into pURL
> get URL pURL
>etc.
There is a potential problem with this approach, which can be avoided by
using numeric IP addresses rather than host names. Using a host name will
cause the Rev app to block for 10-30 seconds while it waits for a DNS
response (see BZ 2117 for details - Mark W.'s solution is a non-blocking ping)
This problem happens to me all the time, because I use my laptop connected
to an ethernet which connects to the internet through another computer
using a dial-up line, and the dial-up is often disconnected. Laptop thinks
it has a connection (the ethernet is up) and thinks it has DNS servers it
can reach (because the main computer acts as a DNS proxy) - but when it
queries a host name, it is blocked until the DNS response times out.
>if your user is not connected, they will probably get an 'invalid host'
>answer. Testing against google seems always to work for me. I figure, if
>they can't get to google, then they can't get to my server.
Google has been the target of a number of DoS attacks, so there have been
at least two occasions when large parts of the net couldn't get an answer
from Google, but could have done from you.
-- Alex.
More information about the use-livecode
mailing list