bobsneidar at iotecdigital.com
Fri Mar 2 15:02:09 EST 2018
Yes, trying to figure out WHY the connection failed is trickier. I think you are right that Safari pings an IP (to exclude DNS problems) and then looks at the response. A ping that has no route will report something like Destination Unreachable as opposed to timeout. On my Apple terminal, if I ping a bogus DNS name, I get cannot resolve <hostname>: unknown host. If I ping a bogus IP, I get a timeout. If I disable all network adapters I get a timeout AND sendto: No route to host. Windows probably does something similar.
I suppose you could simply ping through a shell and then peruse the responses.
> On Mar 2, 2018, at 10:09 , Graham Samuel via use-livecode <use-livecode at lists.runrev.com> wrote:
> Bob of course you’re right - in my particular case, anyway, I just want to know if I can access me chosen server or not.
> But one could certainly imagine programs that would want to know if they were wasting their time offering their users a broader internet access - I mean any program that allows the user to specify addresses (like a browser does) would want more of an “is there or isn’t there?” approach. On my Mac, the Apple browser Safari can announce “you are not connected to the internet”. Maybe it just pings a trusted source and waits for a reasonable time for the reaction.
> Anyway what I noticed in my little experiment was that the reaction of the script when the internet wasn’t available was very rapid (certainly less than half a second), which means that just trying to get the file and then looking for an error response would probably be OK for a human user, since there is no prolonged wait.
> As you see, I am reluctant to do anything that’s at all complicated!
More information about the Use-livecode