Checking if internet is connected using tsNet?
brahma at hindu.org
Fri Jul 27 22:11:51 EDT 2018
Well the use case differences are obvious, but to say the obvious
I am connecting with
a) our own server
AND I want to know if the URL in the app is correct (silly typo in a JSON in the app OR misfiled media on out server...etc), so I would always to get the header of the actual media being called. We can traps errors, send to the MotherShip the URL that failed and fix it... etc.
That different from (Klaus's ?) "am I connected or not"
On 7/27/18, 12:44 PM, "use-livecode on behalf of Mark Wieder via use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode at lists.runrev.com> wrote:
> if (tResult < 400) then
> return true
> 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://22.214.171.124:53".
curl -v --trace-time 126.96.36.199:53
curl -v --trace-time www.google.com
But otherwise, yes... there is no way of checking for the internet
without connecting to the internet.
More information about the use-livecode