testing for Internet connection
Dar Scott
dsc at swcp.com
Sun Dec 19 12:27:23 EST 2004
On Dec 19, 2004, at 5:04 AM, Alex Tweedly wrote:
> 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.
This illustrates that there are several meanings to "is connected to
the Internet".
They might be:
A. This computer thinks there is a route to a public IP address.
B. #A and the route works.
C. This computer can modify routing on demand to get to a public IP
address.
I have not used a dialup connection in a while so, I don't remember all
the problems involved. One problem is that the act of checking can
cause dialing to start.
Some ideas:
1
Open TCP to some http port on a reliable server. This does a B check.
2
Open UPD to any port on a public address. This does an A check and is
fast. Maybe this is less likely to cause a dial than #1. This is
non-intrusive.
3
Parse the results of a command-line utility. Dial-up may take special
consideration. This does an A test.
4
External. A test.
Dar
**********************************************
DSC (Dar Scott Consulting & Dar's Lab)
http://www.swcp.com/dsc/
Programming Services and Software
**********************************************
More information about the use-livecode
mailing list