Checking if internet is connected using tsNet?
Mark Wieder
ahsoftware at sonic.net
Fri Jul 27 18:44:17 EDT 2018
On 07/27/2018 10:48 AM, Sannyasin Brahmanathaswami via use-livecode wrote:
> if (tResult < 400) then
> return true
> else
> return false
> end if
I'd be a little wary of that "< 400" result though. You may (or may not)
want to follow redirects, and if you get a 418 you may want a cuppa <g>.
and due to the extra hops involved, I probably wouldn't try for
"https://www.google.com". DNS resolution will add tens to over a hundred
milliseconds to a web command, so if you're going to go that route
instead of opening a socket I'd go straight to "http://8.8.8.8:53".
curl -v --trace-time 8.8.8.8:53
20 milliseconds
curl -v --trace-time www.google.com
50 milliseconds
But otherwise, yes... there is no way of checking for the internet
without connecting to the internet.
--
Mark Wieder
ahsoftware at gmail.com
More information about the use-livecode
mailing list