libUrl tsNet and socketTimeoutInterval

Charles Warwick charles at techstrategies.com.au
Thu Dec 7 03:43:28 EST 2017


Sorry, divide my figures for the last parameter to tsNetSetTimeouts by 8, it has been a long day!

> On 7 Dec 2017, at 6:33 pm, Charles Warwick <charles at techstrategies.com.au> wrote:
> 
> BR,
> 
> 
>> OK, now going over to the forum on this dropbox thread I see Jacque's and Charle's comments. 5 secs seems a little long.. so if we use the algorithm "We want to tell users what is up or dim content options from remote servers in 3 seconds"  (and FTP is not in the cards) we get: 
>> 
>> tsNetSetTimeouts 60, 3000, 3000 , , 3, 12000
>> 
>> This translates "you must have a 96kbps connection or else…"  right?
>> 
>> FYI the dictionary does not declare units for the pLowSpeedTime, it should… I've assumed integers = seconds and not milliseconds for param 5.
> 
> 
> I will get that fixed in the dictionary in the next version, thanks for letting me know.
> 
> tsNetSetTimeouts uses the last two parameters to determine if a connection should be dropped if the “average” speed of the transfer falls below the values set.
> 
> To use your example, if you want to ensure that the average speed of the transfer does not fall below 96kbps, calculating the average speed over a 3 second period, you would specify a value of 3 for the second last parameter and 96000 (96kbps x 1000 bytes per kB) for the last parameter to tsNetSetTimeouts.
> 
> 
>> Second  (dumb) question: how do we trap for the timeout? we keep checking the tsNetStatusCallback on a loop? and if and when we see timeout we inform the user? But we need a connectionID, so how do we extract a connectionID from put/get/set/ http urls? where we are targeting  browser widget on a card. Or a mobilePlayer?
> 
> 
> If you are using a standard synchronous libUrl request (put URL, post x to URL, etc...) then the request will abort as soon as the connection speed falls below the threshold specified and an error will be stored in the result.
> 
> For asynchronous tsNet requests, the callback message will be sent with an error code indicating the failure.
> 
> Hope that helps,
> 
> Cheers.
> 
> Charles
> 





More information about the use-livecode mailing list