[REBOL] Re: Internet connection
From: antonr:iinet:au at: 6-May-2003 23:08
No, and connected? is not a good indicator of
whether you will get to your resource or not.
Connected? just tells you whether there is a
connection from your machine to another machine.
That second machine may be connected to nothing
else (or allows no connections to other machines
because its web server is down, for example).
For dialup users it may be an ok indicator, but
for instance, DSL users who have a router in between
their machine and the DSL modem, it is a very poor
indicator of whether "the internet" is available.
If you make the assumption that the user has dialup,
your code will only work for dialup users.
The best way to see if a network resource is available
is to either see if it exists, or just try to download
it. You will receive an error if there is a problem
anywhere on the (possibly long) chain of machines
between your machine and the one with the resource.
It's easy to catch this error and take appropriate
action. This turns out to be better code anyway.
It would be nice to be able to cause a dialup connection
to dialup, but then this is very OS specific code.
You must delve into external libraries for this.