Synchronous FTP upload?

Richard Gaskin ambassador at FourthWorld.com
Wed Jun 26 21:12:01 EDT 2002


Dave Cragg wrote:

> At 3:30 am -0700 25/6/02, Richard Gaskin wrote:
> 
>>> 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?
> 
> It won't suspend script execution or messages; as you say, just the
> opposite. But you can use it to make a particular script wait at a
> particular point while other stuff (e.g. a download) completes. But
> I'm sure it's not a suitable approach in all circumstances.

Hmmm... still stumped on how to proceed, I'm afraid.

Here's the relevant snippet from my script:

   put "ftp://"& tUser &":"& tPword &"@"& tHost &\
      "/"& tDir &"/" into tBaseDestUrl
    put 0 into tCounter
    put the number of lines of tFileList into tMaxCount
    InitProgress  "Uploding files...", tMaxCount
    repeat for each line tDestFile in tFileList
      add 1 to tCounter
      put line 1 of tFileList into tDestFile
      put tBaseDestUrl & tDestFile into tDestUrl
      doProgress "Uploading file "&tCounter&" of "&tMaxCount, tCounter
      put url ("file:"&line 1 of tFileList) into url tDestUrl
      Err the result
    end repeat


My aim is to step through the list of local files in tFileList and upload
each, incrementing a progress indicator as each file completes (each file is
only a few k, so this level of granularity for the user feedback is okay).

Running the script above, the first file transfers fine but I get a socket
timeout on the second.

I've started down the road of writing my own FTP lib as Andu suggested, but
it's a fair amount of work to get it right, as you know.  Besides, what's
the value of having a libURL if we wind up each rolling our own?  I'd much
rather contribute to something of shared value, if possible, so Rev/MC
developers can spend less time error-checking the nuances of obscure FTP
server configurations (does AOL really need to display such a long welcome
message?) and more time providing unique, empowering client solutions.

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