Question re download timeout setting

matthias_livecode_150811 at m-r-d.de matthias_livecode_150811 at m-r-d.de
Sat Jul 22 07:30:38 EDT 2023


Hello Bill,

since V8 or so tsNET external is included in any commercial/business license.
Even put URL "ftp: or http:  will be executed with tsNET by liburl.

So in case you did not manually disabletsNET for your app, you could use   tsNetSetTimeouts to set timeout values.
By default tsNET does not limit the time a request could take and that might be the reason why the put URL takes forever.

The Syntax looks like this
tsNetSetTimeouts pDnsCacheTimeout, pRequestTimeoutMS, pConnectTimeoutMS, pAcceptTimeoutMS, pLowSpeedTime, pLowSpeedLimit

The second parameter is responsible for the request timeout and has to be set in milliseconds.

So for example

tsNetSetTimeouts 30, 33000, 300000, 60000, 30, 1000

would set the request timeout to 33 seconds. The other values in my example are the default values.

After the timeout the script continues and you could check if the put command returned the expected value.



Regards,
Matthias



> Am 22.07.2023 um 02:02 schrieb prothero--- via use-livecode <use-livecode at lists.runrev.com>:
> 
> Folks:
> Sorry for the trivial question, but..
> I have an app on my iphone that I am updating from a several years old app the previously worked on an older version of livecode. It needs to access a mysql database on the internet. It works fine when there is internet service. 
> 
> I test access by downloading a file with a simple text code. If there code is returned in the message, I continue accessing the database. However, when there is no internet, the "put URL” command seems to hang forever. I’ve looked for a way to set the timeout for an internet command, but…. can’t,.
> 
> Could you direct me to a simple explanation about how to set a reasonable internet not connected message?
> 
> Thanks,
> Bill
> put "https://"&theURL&"/test.html" into theURL
> 
> put URL theURL into tOutput    —if the request times out, the output is not received.
> 
> if tOutput contains "AB7699HEYIMHERE” then   —code received, internet access is successful
> 
> return true
> 
> else
> 
> return false
> 
> end if
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list