[ANN] Release 8.1.5 -- tsneterr
Charles Warwick
charles at techstrategies.com.au
Thu Jul 13 06:52:26 EDT 2017
Hi Dan,
The resetAll command is very destructive, in that it closes all
currently open connections. In certain circumstances it has been
required when using the traditional libUrl library to work around
network errors and in order to maintain feature parity, it does also
work with tsNet.
However I generally would not recommend using it with tsNet as there are
other mechanisms available in tsNet to enable it to handle network
problems more gracefully.
I recommend taking a look at the tsNetSetTimeouts function that is
available in tsNet 1.2.10 (which is included in LC 8.1.5). In
particular, have a look at the pLowSpeedTime and pLowSpeedLimit
parameters to that function. They allow you to set a minimum number of
bytes that must be sent/received within a specified time period for the
connection to be considered acceptable by tsNet. If the speed of
transfer falls below that amount, the connection will be timed out
returning control to your script.
This should prevent connections from stalling and not returning - which
is generally where the use of resetAll comes into play.
If you are using apps within a mobile environment where network
connectivity can come and go frequently, it may also be worth setting
"tsNetLibUrlReuseConnection false" at the start of your application.
Having said all of that, it is still possible to use resetAll, though
some care must be taken. With tsNet, it briefly disables the external
and then re-enables it. My guess is that another handler is trying to
process a URL request while the resetAll is being performed.
The easiest way to see if tsNet is in use by libUrl is:
putthebehaviorofstack"revLibUrl"intotLibUrlDriver
if tLibUrlDriver isemptythen
answer"tsNet is disabled"
else
answer"tsNet in use"
end if
Best Regards,
Charles
On 13/07/2017 4:34 AM, Dan Friedman via use-livecode wrote:
> Charles,
>
> Yes, I do have resetAll in my scripts. I use it when a communications error has occurred as a way to reset and try again. If tsNet is in play, I gather I should not call resetAll? If not, is there something else I should be doing? Also, is there a way (via a property) to determine if tsNet or libURL is handling the network?
>
> Thank you!
>
> -Dan
>
>
> On 7/12/17, 9:38 AM, "use-livecode on behalf of use-livecode-request at lists.runrev.com" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode-request at lists.runrev.com> wrote:
>
> Hi Dan,
>
> The error message "Not initialised" (the spelling is correct depending
> on where you live ;-) ) indicates that the tsNet external isn't running.
>
> If you are using libUrl which I am guessing you are, tsNet is
> initialised on startup, so this would indicate that it has either been
> shut down by calling tsNetClose directly, or by a call to the libUrl
> "resetAll" or "libUrlCancel" commands (which temporarily shut down the
> external and start it back up to clear all connections).
>
> I have seen code posted on the list in the past which invoked "resetAll"
> to deal with issues in older versions of libUrl. Do you use these
> commands at all in your project?
>
> Regards,
>
> Charles
>
> _______________________________________________
> 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