Internet checking?

Graham Samuel livfoss at mac.com
Fri Mar 2 06:44:13 EST 2018


Jacque, thanks. It seems like overkill to load up and initialise tsnet just to get a 20-byte text file. I’m really surprised there isn’t a foolproof way to find out if one’s device is connected to the internet or not. I am not good on internet functions, but don’t a huge number of apps in the real world want to know if they’re connected or not?

Maybe I will write a tiny standalone that just talks to my server, and experiment with switching off the internet connection to see what errors I get.

Puzzled

Graham

> On 1 Mar 2018, at 06:47, J. Landman Gay via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> On 2/28/18 5:20 PM, Graham Samuel via use-livecode wrote:
>> I know this is a golden oldie, but I can’t find a reference… I have a script that wants to check a file on a server, and basically to do nothing if the program is offline.
>> Remind me, is there an easy way to tell from within an LC standalone if the internet is not accessible? I don’t want my program to hang. I understand the URLStatus will eventually tell me if access did not occur, but I don’t understand how to limit the waiting time to something reasonable. I notice that some browsers can actually display a message saying something like “you are not connected to the internet” - how do they do that?
> 
> I haven't actually played with it, but it looks like tsNetSetTimeouts might work if you set the pConnectTimeoutMS (the third param) to something shorter than the default. Then when you try to retrieve your file when there is no connection, you should get an error from tsNet.
> 
> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com





More information about the Use-livecode mailing list