Re: Check connection and timeout

2023-07-15 Thread Ludovic THEBAULT via use-livecode


> Le 14 juil. 2023 à 17:14, Ralph DiMola via use-livecode 
>  a écrit :
> 
> Ludovic,
> 
> Make sure that tsNet is active:
> 


Hello Ralph


Thanks. But yes tsnet was initialized.

I’ve measured the timeouts in miliseconds and it was always 30003 milliseconds.
But it’s only when there is a connection but there isn't enough network 
capacity for data transfer (so it’s difficult to test ! This can happen in the 
mountains, far from mobile antennas, or on the edge of wifi coverage.


Ludovic
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Check connection and timeout

2023-07-14 Thread Bob Sneidar via use-livecode
Hi Ludovic. 

I use a simple method of sockets to determine if I have a connection to a host. 
I close the socket first: 

closeSocket 127.0.0.1:3306

Then I open the socket:

Open socket to 127.0.0.1:3306
Put the result into tError

If terror begins with “ERROR: “ then
   — your code here
End if

Then close the socket again. 

Close socket 127.0.0.1:3306

I find this to be the most reliable way to check a connection. I may not have 
internet, but the host may not be on the internet it may be local. Also, 
sockets will always work whereas ICMP can be blocked by a firewall. And simply 
trying to connect to a host will, as you have noticed bring timeouts into play. 

Bob S



> On Jul 13, 2023, at 11:26 PM, Ludovic THEBAULT via use-livecode 
>  wrote:
> 
> Hello,
> 
> I use this code to check is there is an internet connection :
> 
> tsNETSETTIMEOUTS 60,0,2000,6,5,1000
> 
> put tsNetHeadSync("https://google.com/;, tHeaders, tResult, tBytes) into 
> tRecvHeaders
> 
>   if tResult begins with "tsneterr:" then
>  return false 
>   else
>  return true 
>   end if
> 
> 
> But the setting for the timeout of tsNETSETTIMEOUTS is not active, I always 
> have a 30 seconds timeout.
> 
> Is there an other settings ?
> 
> Thanks.
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Check connection and timeout

2023-07-14 Thread Bob Sneidar via use-livecode
Oooohhh… code candy! Thanks again Ralph! 

Bob S


> On Jul 14, 2023, at 9:04 AM, Ralph DiMola via use-livecode 
>  wrote:
> 
> Bob,
> 
> I use this function to return an array of the timeouts.
> 
> function EIStsNetGetTimeouts
>   local tTimeouts, tTsNetTimeoutArray
>   put tsNetGetTimeouts() into tTimeouts
>   put item 1 of tTimeouts into tTsNetTimeoutArray["DnsCacheTimeout"]
>   put item 2 of tTimeouts into tTsNetTimeoutArray["RequestTimeoutMS"]
>   put item 3 of tTimeouts into tTsNetTimeoutArray["ConnectTimeoutMS"]
>   put item 4 of tTimeouts into tTsNetTimeoutArray["AcceptTimeoutMS"]
>   put item 5 of tTimeouts into tTsNetTimeoutArray["LowSpeedTime"]
>   put item 6 of tTimeouts into tTsNetTimeoutArray["LowSpeedLimit"]
>   return tTsNetTimeoutArray
> end EIStsNetGetTimeouts
> 
> Ralph DiMola
> IT Director
> Evergreen Information Services
> rdim...@evergreeninfo.net
> 
> 
> -Original Message-
> From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf
> Of Bob Sneidar via use-livecode
> Sent: Friday, July 14, 2023 11:47 AM
> To: How to use LiveCode
> Cc: Bob Sneidar
> Subject: Re: Check connection and timeout
> 
> Thanks Ralph, very handy, but is there a way to get the timeout to see if
> the command to set the timeout worked? I change networks frequently, and if
> I do not disconnect and reconnect to my SQL database, I run the risk of
> using a stale connection, and then I face the dreaded 60 second stall before
> I can proceed.
> 
> Bob S
> 
> 
> On Jul 14, 2023, at 8:36 AM, Ralph DiMola via use-livecode
>  wrote:
> 
> Sorry,
> 
> It was mine...
> 
> function GetNetworkType
>  local tLibUrlDriver
>  try
> put the behavior of stack"revLibUrl" into tLibUrlDriver
>  end try
>  if tLibUrlDriver is empty then
> return "libURL"
>  else
> return "tsNet"
>  end if
> end GetNetworkType
> 
> Ralph DiMola
> IT Director
> Evergreen Information Services
> rdim...@evergreeninfo.net<mailto:rdim...@evergreeninfo.net>
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


RE: Check connection and timeout

2023-07-14 Thread Ralph DiMola via use-livecode
Bob,

I use this function to return an array of the timeouts.

function EIStsNetGetTimeouts
   local tTimeouts, tTsNetTimeoutArray
   put tsNetGetTimeouts() into tTimeouts
   put item 1 of tTimeouts into tTsNetTimeoutArray["DnsCacheTimeout"]
   put item 2 of tTimeouts into tTsNetTimeoutArray["RequestTimeoutMS"]
   put item 3 of tTimeouts into tTsNetTimeoutArray["ConnectTimeoutMS"]
   put item 4 of tTimeouts into tTsNetTimeoutArray["AcceptTimeoutMS"]
   put item 5 of tTimeouts into tTsNetTimeoutArray["LowSpeedTime"]
   put item 6 of tTimeouts into tTsNetTimeoutArray["LowSpeedLimit"]
   return tTsNetTimeoutArray
end EIStsNetGetTimeouts

Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net


-Original Message-
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf
Of Bob Sneidar via use-livecode
Sent: Friday, July 14, 2023 11:47 AM
To: How to use LiveCode
Cc: Bob Sneidar
Subject: Re: Check connection and timeout

Thanks Ralph, very handy, but is there a way to get the timeout to see if
the command to set the timeout worked? I change networks frequently, and if
I do not disconnect and reconnect to my SQL database, I run the risk of
using a stale connection, and then I face the dreaded 60 second stall before
I can proceed.

Bob S


On Jul 14, 2023, at 8:36 AM, Ralph DiMola via use-livecode
 wrote:

Sorry,

It was mine...

function GetNetworkType
  local tLibUrlDriver
  try
 put the behavior of stack"revLibUrl" into tLibUrlDriver
  end try
  if tLibUrlDriver is empty then
 return "libURL"
  else
 return "tsNet"
  end if
end GetNetworkType

Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net<mailto:rdim...@evergreeninfo.net>

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Check connection and timeout

2023-07-14 Thread Bob Sneidar via use-livecode
Thanks Ralph, very handy, but is there a way to get the timeout to see if the 
command to set the timeout worked? I change networks frequently, and if I do 
not disconnect and reconnect to my SQL database, I run the risk of using a 
stale connection, and then I face the dreaded 60 second stall before I can 
proceed.

Bob S


On Jul 14, 2023, at 8:36 AM, Ralph DiMola via use-livecode 
 wrote:

Sorry,

It was mine...

function GetNetworkType
  local tLibUrlDriver
  try
 put the behavior of stack"revLibUrl" into tLibUrlDriver
  end try
  if tLibUrlDriver is empty then
 return "libURL"
  else
 return "tsNet"
  end if
end GetNetworkType

Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


RE: Check connection and timeout

2023-07-14 Thread Ralph DiMola via use-livecode
Sorry,

It was mine...

function GetNetworkType
   local tLibUrlDriver
   try
  put the behavior of stack"revLibUrl" into tLibUrlDriver
   end try
   if tLibUrlDriver is empty then
  return "libURL"
   else
  return "tsNet"
   end if
end GetNetworkType

Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net

-Original Message-
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of 
Bob Sneidar via use-livecode
Sent: Friday, July 14, 2023 11:21 AM
To: How to use LiveCode
Cc: Bob Sneidar
Subject: Re: Check connection and timeout

getNetwotkType() is not a valid function. 

Bob S


> On Jul 14, 2023, at 8:14 AM, Ralph DiMola via use-livecode 
>  wrote:
> 
> Ludovic,
> 
> Make sure that tsNet is active:
> 
> command NetworkType
>   if GetNetworkType() = "libURL" then
>  answer"tsNet is disabled(LibURL)"
>   else
>  answer "tsNet in use"&"Version==>"& tsNetVersion()
>   end if
> end NetworkType
> 
> Did you initialize tsNet? ==> tsNetInit
> 
> Disable tsNet ==> dispatch "revunloadlibrary" to stack "tsnetliburl"
> To enable tsNet ==> dispatch "revloadlibrary" to stack "tsnetliburl"
> 
> Ralph DiMola
> IT Director
> Evergreen Information Services
> rdim...@evergreeninfo.net
> 
> -Original Message-
> From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf 
> Of Ludovic THEBAULT via use-livecode
> Sent: Friday, July 14, 2023 3:51 AM
> To: How to use LiveCode
> Cc: Ludovic THEBAULT
> Subject: Re: Check connection and timeout
> 
> 
> 
>> Le 14 juil. 2023 à 08:26, Ludovic THEBAULT via use-livecode 
>>  a écrit :
>> 
>> Hello,
>> 
>> I use this code to check is there is an internet connection :
>> 
>> tsNETSETTIMEOUTS 60,0,2000,6,5,1000
>> 
>> put tsNetHeadSync("https://google.com/;, tHeaders, tResult, tBytes) into 
>> tRecvHeaders
>> 
>>  if tResult begins with "tsneterr:" then
>> return false 
>>  else
>> return true 
>>  end if
>> 
>> 
>> But the setting for the timeout of tsNETSETTIMEOUTS is not active, I always 
>> have a 30 seconds timeout.
>> 
>> Is there an other settings ?
>> 
> 
> 
> Addendum :  it happen when there is a connection (aka in 4G or Wifi) but no 
> enough network.
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Check connection and timeout

2023-07-14 Thread Bob Sneidar via use-livecode
getNetwotkType() is not a valid function. 

Bob S


> On Jul 14, 2023, at 8:14 AM, Ralph DiMola via use-livecode 
>  wrote:
> 
> Ludovic,
> 
> Make sure that tsNet is active:
> 
> command NetworkType
>   if GetNetworkType() = "libURL" then
>  answer"tsNet is disabled(LibURL)"
>   else
>  answer "tsNet in use"&"Version==>"& tsNetVersion()
>   end if
> end NetworkType
> 
> Did you initialize tsNet? ==> tsNetInit
> 
> Disable tsNet ==> dispatch "revunloadlibrary" to stack "tsnetliburl"
> To enable tsNet ==> dispatch "revloadlibrary" to stack "tsnetliburl"
> 
> Ralph DiMola
> IT Director
> Evergreen Information Services
> rdim...@evergreeninfo.net
> 
> -Original Message-
> From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf 
> Of Ludovic THEBAULT via use-livecode
> Sent: Friday, July 14, 2023 3:51 AM
> To: How to use LiveCode
> Cc: Ludovic THEBAULT
> Subject: Re: Check connection and timeout
> 
> 
> 
>> Le 14 juil. 2023 à 08:26, Ludovic THEBAULT via use-livecode 
>>  a écrit :
>> 
>> Hello,
>> 
>> I use this code to check is there is an internet connection :
>> 
>> tsNETSETTIMEOUTS 60,0,2000,6,5,1000
>> 
>> put tsNetHeadSync("https://google.com/;, tHeaders, tResult, tBytes) into 
>> tRecvHeaders
>> 
>>  if tResult begins with "tsneterr:" then
>> return false 
>>  else
>> return true 
>>  end if
>> 
>> 
>> But the setting for the timeout of tsNETSETTIMEOUTS is not active, I always 
>> have a 30 seconds timeout.
>> 
>> Is there an other settings ?
>> 
> 
> 
> Addendum :  it happen when there is a connection (aka in 4G or Wifi) but no 
> enough network.
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Check connection and timeout

2023-07-14 Thread Bob Sneidar via use-livecode
I’m interested in this. But how do you GET the timeout? 

Bob S


> On Jul 13, 2023, at 11:26 PM, Ludovic THEBAULT via use-livecode 
>  wrote:
> 
> Hello,
> 
> I use this code to check is there is an internet connection :
> 
> tsNETSETTIMEOUTS 60,0,2000,6,5,1000
> 
> put tsNetHeadSync("https://google.com/;, tHeaders, tResult, tBytes) into 
> tRecvHeaders
> 
>   if tResult begins with "tsneterr:" then
>  return false 
>   else
>  return true 
>   end if
> 
> 
> But the setting for the timeout of tsNETSETTIMEOUTS is not active, I always 
> have a 30 seconds timeout.
> 
> Is there an other settings ?
> 
> Thanks.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


RE: Check connection and timeout

2023-07-14 Thread Ralph DiMola via use-livecode
Ludovic,

Make sure that tsNet is active:

command NetworkType
   if GetNetworkType() = "libURL" then
  answer"tsNet is disabled(LibURL)"
   else
  answer "tsNet in use"&"Version==>"& tsNetVersion()
   end if
end NetworkType

Did you initialize tsNet? ==> tsNetInit

Disable tsNet ==> dispatch "revunloadlibrary" to stack "tsnetliburl"
To enable tsNet ==> dispatch "revloadlibrary" to stack "tsnetliburl"

Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net

-Original Message-
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of 
Ludovic THEBAULT via use-livecode
Sent: Friday, July 14, 2023 3:51 AM
To: How to use LiveCode
Cc: Ludovic THEBAULT
Subject: Re: Check connection and timeout



> Le 14 juil. 2023 à 08:26, Ludovic THEBAULT via use-livecode 
>  a écrit :
> 
> Hello,
> 
> I use this code to check is there is an internet connection :
> 
> tsNETSETTIMEOUTS 60,0,2000,6,5,1000
> 
> put tsNetHeadSync("https://google.com/;, tHeaders, tResult, tBytes) into 
> tRecvHeaders
> 
>   if tResult begins with "tsneterr:" then
>  return false 
>   else
>  return true 
>   end if
> 
> 
> But the setting for the timeout of tsNETSETTIMEOUTS is not active, I always 
> have a 30 seconds timeout.
> 
> Is there an other settings ?
> 


Addendum :  it happen when there is a connection (aka in 4G or Wifi) but no 
enough network.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Check connection and timeout

2023-07-14 Thread Ludovic THEBAULT via use-livecode


> Le 14 juil. 2023 à 08:26, Ludovic THEBAULT via use-livecode 
>  a écrit :
> 
> Hello,
> 
> I use this code to check is there is an internet connection :
> 
> tsNETSETTIMEOUTS 60,0,2000,6,5,1000
> 
> put tsNetHeadSync("https://google.com/;, tHeaders, tResult, tBytes) into 
> tRecvHeaders
> 
>   if tResult begins with "tsneterr:" then
>  return false 
>   else
>  return true 
>   end if
> 
> 
> But the setting for the timeout of tsNETSETTIMEOUTS is not active, I always 
> have a 30 seconds timeout.
> 
> Is there an other settings ?
> 


Addendum :  it happen when there is a connection (aka in 4G or Wifi) but no 
enough network.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode