[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaSocket: Check if Internet connection is up
- From: HyperHacker <hyperhacker@...>
- Date: Sun, 12 Feb 2012 02:55:30 -0700
On Sun, Feb 12, 2012 at 02:45, Andreas Falkenhahn
<andreas@falkenhahn.com> wrote:
>
> Hi,
>
> how would I check if an Internet connection is available using LuaSocket?
> Should I simply try to connect to a server or is there a better way to do
> this?
>
> Tks,
>
> Andreas
>
>
Probably you want to try to connect to something. You can't really say
a connection is up or not... they might have a good connection to
their LAN, but that LAN doesn't have access to the internet. Or even
the ISP has troubles (or the user lives in a country that censors
websites) and not all of the internet is reachable at the moment...
If you want to connect to a specific server, don't bother trying to
check for all possible problems that could prevent it; just try, and
report anything that goes wrong. If you just want to inform the user
whether their connection seems to be working or not, the best way
would be to try to ping a few hosts that aren't likely to all fail at
once (google.com, microsoft.com, etc) and see if you can get through
to any of them.
--
Sent from my toaster.