slow load URL

Eric Chatonet eric.chatonet at sosmartsoftware.com
Mon May 12 05:58:11 EDT 2008


Bonjour Nicolas,

Instead of setting by yourself a pending message you could take  
advantage of libURLSetStatusCallback: this will simplify your code.
Anyway, it should not change anything about speed... that is mainly  
related to your own speed connection and server's abilities ;-)

Le 12 mai 08 à 05:00, Nicolas Cueto a écrit :

> Hello,
>
> I have a stack that requires dowloading 40 to 200 image/sound files
> (about 40Kb each).  The download time is pretty long so I'm wondering
> if part of the problem is my script, which I've included below.
>
> Thank you.
>
> -- Nicolas Cueto
>
>
> on startDownloads
>   set the socketTimeoutInterval to 15000
>   put theUrl into tTheUrl
>   /*  Clear any cached urls.    */
>   repeat for each line thisURL in the cachedURLs
>      unload URL thisURL
>   end repeat
>   repeat for each line tImgOrSndID in tImgOrSndIDs
>       put tTheUrl & tImgOrSndID into tURLPath
>       load URL tURLPath
>       ShowInfo tDU
>       wait until "showInfo" is not among the items of the
> pendingMessages with messages
>   end repeat
> end startDownloads
>
>
> -- ShowInfo is a pending message which
> -- monitors download status every 10 milliseconds.
> -- By Eric Chatonet.
>
> on ShowInfo pUrl
>   local tStatus,tResult
>   -----
>   put URLStatus(pUrl) into tStatus
>   switch
>   case word 1 of tStatus = "error"
>     answer "Sorry: invalid URL or no connection."
>     put pUrl & cr after gFailedDownloads
>     break
>   case tStatus = empty
>     answer "Sorry: invalid URL or no connection."
>     put pUrl & cr after gFailedDownloads
>     break
>   case word 1 of tStatus = "timeout"
>     answer "Sorry: time out."
>     put pUrl & cr after gFailedDownloads
>     break
>   case item 1 of tStatus = "loading"
>       break
>   case word 1 of tStatus = "cached"
>     exit ShowInfo
>     break
>   end switch
>   send "ShowInfo" && pUrl to me in 10 milliseconds
> end ShowInfo


Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------





More information about the use-livecode mailing list