Synchronous FTP upload?

Dave Cragg dcragg at lacscentre.co.uk
Tue Jun 25 05:22:01 EDT 2002


At 11:35 pm -0700 24/6/02, Richard Gaskin wrote:

>How can I upload a file synchronously, such that all scripts stop until
>either the file is uploaded successfully or an error is encountered?
>
>I have a fairly complex setup in which I nee to avid race conditions, and
>using "put" seems to allow processing of other messages while it's
>connecting and uploading.
>
>Thanks in advance -

I agree that this is a limitation in the way "blocking" calls work in 
libUrl. Only the script that  makes the blocking call is blocked. 
Handlers that are in the pending messages for example will still run. 
I can't think of an easy way to stop *all* other scripts running, but 
it should be possible on a script-by-scripts basis.

For running handlers that need to wait for the upload to complete, 
you could insert something like this at appropriate points:

repeat until <condition>
   wait for messages
end repeat

Just be sure the condition will eventually come true.

I had been thinking of changing the way blocking calls operate in 
libUrl by doing synchronous reads/writes inside a repeat loop. Right 
now I'm not sure how feasible this is -- it will require some fairly 
big changes in libUrl (blocking and non-blocking calls currently 
share a lot of the script). But if there's a big need, I'll certainly 
take a look at it.

Cheers
Dave



More information about the metacard mailing list