Synchronous FTP upload?

Richard Gaskin ambassador at FourthWorld.com
Tue Jun 25 07:12:01 EDT 2002


Dave Cragg wrote:

> 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.

My understanding of "wait for messages" was the opposite, that it was
designed to allow asynchronous behavior. Is there a way to use it to suspend
script execution and event messages while waiting for an upload to complete?
> 
> 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.

Admittedly this is rare, even for me.  But when you need it, you really need
it.  I've considered writing my own lib for this, but it's a lot of work to
re-invent something that would be 90% overlap anyway. ")

-- 
 Richard Gaskin 
 Fourth World Media Corporation
 Custom Software and Web Development for All Major Platforms
 Developer of WebMerge 2.0: Publish any Database on Any Site
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com
 Tel: 323-225-3717                       AIM: FourthWorldInc




More information about the metacard mailing list