URL download and Cache problems

Alex Tweedly alex at tweedly.net
Wed Dec 15 18:33:40 EST 2004


At 12:59 15/12/2004 -0800, Richard Gaskin wrote:

>This conversation raises a question -
>
>There are currently two ways to download files, the "load" command and 
>"get URL".

3 if you count libURLDownloadToFile  (though it's for ftp only)

>It used to be the case that "load" was a better option for longer 
>downloads and/or if you need to update a progress bar, since it was the 
>only one of the two that was non-blocking and you could querty the 
>urlStatus for those downloads.
>
>But now that we have the libUrlStatusCallback option, which provides 
>periodic messages for "get URL", is there any benefit to using "load"?

Yes, lots of them (I think).

libURLSetStatusCallback provides you with periodic callbacks during 
(amongst other things) a
    get URL ....
command. However, it would be a bit convoluted to carry on and do other 
processing from within such a callback; updating a progress bar/field would 
be fine, but going on to do more than that feels a bit complicated.

Using load allows you to carry on with other general purpose processing of 
any kind, while still providing both periodic callbacks AND "when complete" 
callback.

Also (if I read the docs correctly - haven't tried it), you cannot initiate 
a second blocking operation while the first one is still in progress (docs 
say this results in an error "Error Previous request not completed").  If 
you want to retrieve a number of URLs in parallel, the load command is 
still the only way.

-- Alex.


More information about the use-livecode mailing list