best downloading architecture - vote 1, 2, 3 or 4

Jim Ault JimAultWins at yahoo.com
Wed Dec 6 00:41:00 EST 2006


 On 12/5/06 7:53 PM, "Josh Mellicker" <josh at dvcreators.net> wrote:
> 
> 2. the "splash" app first downloads the Main Stack and runs it, but
> the "splash" app continues to download a whole list of files in the
> background
> 
> This would be ideal, but is it feasible to set up a callback
> framework where the Main Stack code could check download status and
> make decisions based on whether certain files had downloaded yet?

Here is an example of a simple script I use for a stub-download-Main
 with output to follow:
--field 2 log
--field 3 pct
------------------------------------
on mouseup

 libURLSetLogField "field 2"
 libURLSetStatusCallback  "setPercentage",(the long id of this card)
    --bunches of other stuff
end mouseup


on setPercentage urlDL, statusDL
  replace "/" with space in urlDL
  if statusDL contains "loading" then
    try
      put 100*item 2 of statusDL/item 3 of statusDL into pctDL
    end try
    put  word -1 of urlDL &"  %done......  "& pctDL & cr before field 3
  else if statusDL contains "error" then
    --to be done later
  else
    put cr & "status of "& word -1 of urlDL & " is ... "& statusDL & cr
before field 3
  end if
end setPercentage

-----------------    LOG  ----------------------------------
socket selected: 12.191.44.40:21|6928
220 ProFTPD 1.2.10 Server (ProFTPD Default Installation) [12.191.44.40]

USER can1a2da3
331 Password required for whosit.

PASS <password>
230 User whosit logged in.

257 "/" is current directory.

TYPE I
200 Type set to I

SIZE /web/cardPrint004.rev
213 2118986

PASV
227 Entering Passive Mode (12,191,44,40,144,203).

RETR /web/cardPrint004.rev
150 Opening BINARY mode data connection for /web/cardPrint004.rev (2118986
bytes)

CLOSED 12.191.44.40:37067|6928
226 Transfer complete.

QUIT
221 Goodbye.

CLOSED 12.191.44.40:21|6928
CLOSED 12.191.44.40:21|6928

------------2 Mb  download in about 30 secs -------
----written in reverse order -----------
status of cardPrint004.rev is ... downloaded
cardPrint004.rev  %done......  100
cardPrint004.rev  %done......  99.771872
cardPrint004.rev  %done......  99.703537
cardPrint004.rev  %done......  99.635203
cardPrint004.rev  %done......  99.566868
cardPrint004.rev  %done......  99.498534
cardPrint004.rev  %done......  99.29353
cardPrint004.rev  %done......  99.156861
cardPrint004.rev  %done......  99.088526
cardPrint004.rev  %done......  98.951857
--snip --
cardPrint004.rev  %done......  1.64003
cardPrint004.rev  %done......  1.571695
cardPrint004.rev  %done......  1.435026
cardPrint004.rev  %done......  1.298357
cardPrint004.rev  %done......  1.161688
cardPrint004.rev  %done......  1.025019
cardPrint004.rev  %done......  0.888349
cardPrint004.rev  %done......  0.75168
cardPrint004.rev  %done......  0.683346
cardPrint004.rev  %done......  0.615011
cardPrint004.rev  %done......  0.546677
cardPrint004.rev  %done......  0.410007
cardPrint004.rev  %done......  0.341673
cardPrint004.rev  %done......  0.273338
cardPrint004.rev  %done......  0.205004
cardPrint004.rev  %done......  0.136669

status of cardPrint004.rev is ... requested

status of cardPrint004.rev is ... contacted

status of cardPrint004.rev is ... connected

status of cardPrint004.rev is ... connecting









More information about the use-livecode mailing list