[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaSocket: Check if Internet connection is up
- From: Eduardo Ochs <eduardoochs@...>
- Date: Sun, 12 Feb 2012 12:20:39 -0200
On Sun, Feb 12, 2012 at 7:55 AM, HyperHacker <email@example.com> wrote:
> On Sun, Feb 12, 2012 at 02:45, Andreas Falkenhahn
> <firstname.lastname@example.org> 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.
You can try to ping 126.96.36.199, which is the address of Google DNS...