Possible problem with successive use of get url

Dave Cragg dcragg at lacscentre.co.uk
Wed Jun 29 09:02:23 EDT 2005


Hi

I've just Bugzilla'd this (#2955), but thought I'd mention it here in  
case anyone is having this problem.

It only affects Windows and possible only XP SP2 (I can't confirm  
with other Windows versions right now).

The problem:

In a script, ...
   ... if you use get url "http:// whatever..."),
   ... then immediately follow this with a *long* piece of script  
activity (e.g. a repeat loop that may take more than a few seconds to  
complete),
   ... then get the same url or a url at the same server as the  
previous one

you *may* get an error in the result of the second "get url". The  
error may be described as "10053 error on socket",  or be undefined.

The error occurs when the "long activity" between the successive "get  
url" calls exceeds the time the server keeps its connections open.  
This varies by servers, but is typically in the 5 to 20 second range.  
An error won't occur if the server doesn't keep the connection open  
(and includes a "Connection: close"  header in its response.)

The problem seems to be that the engine (on XP SP2 at least) doesn't  
update what the openSockets returns during continuous script activity.

There are two workarounds just now:

1.  Add a short "wait" after the "long activity" has completed. (200  
milliseconds works here, YMMV)
2.  Add a "Connection: close" line to the httpheaders before making  
your get url calls. (This causes the server to add the same header in  
its response. libUrl recognizes this and won't re-use the socket.)

Cheers
Dave



More information about the use-livecode mailing list