livfoss at mac.com
Fri Mar 2 13:09:41 EST 2018
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!
> On 2 Mar 2018, at 16:47, Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
> Hi Graham.
> Whether or not you are connected to the internet isn't really the issue, is it? All that means is that you have a route to the WAN port of your edge router. I mean, the real issue is finding out if you can reach a particular server on a particular port using DNS, or else a given IP address, whether or not it is "on the internet". That is I think, what you really mean.
> The code I posted, while it has some exterraneous code dependent on sqlYoga calls, neverless is a framework for doing that.
> 1. Outer loop to allow user to retry (not strictly necessary but it lets the user attempt to fix the problem before dumping him).
> 2. Inner loop to open socket to prescribed server (Not necessary either, but you may want to check multiple times for the open socket in case of slow connections, and timeout after x tries).
> Bob S
>> On Mar 2, 2018, at 03:44 , Graham Samuel via use-livecode <use-livecode at lists.runrev.com> wrote:
>> I’m really surprised there isn’t a foolproof way to find out if one’s device is connected to the internet or not.
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the Use-livecode