hibbidiji
asked on
best way to implement a download manager: extension
This is a question for TheRealLoki and is a reference to:
https://www.experts-exchange.com/questions/21854739/best-way-to-implement-a-download-manager.html
TheRealLoki,
Can you please post the extended code example you mentioned in your previous answer?
https://www.experts-exchange.com/questions/21854739/best-way-to-implement-a-download-manager.html
TheRealLoki,
Can you please post the extended code example you mentioned in your previous answer?
I also look forward to seeing the extended code, TheRealLoki answered my questions about Threads the other day and I found his code to be excellent, I read the previous question (in your question) and again his code is really nice to read.... learning alot from you TheRealLoki =) keep up the good work.
ASKER
I'm glad to see that these questions are helping other people - I always worry that I'm too specific :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oh, for later versions, check the main page directly
https://sourceforge.net/projects/internetdemos/
https://sourceforge.net/projects/internetdemos/
Hey there,
Thanks for this, however I goto download it and it says invalid archive (16.6k big)
tired all the mirrors and get the same on all of them... Will try again in 15 but just a heads up.
Thanks for this, however I goto download it and it says invalid archive (16.6k big)
tired all the mirrors and get the same on all of them... Will try again in 15 but just a heads up.
ASKER
TheRealLoki,
I downloaded and opened the project in D2005 with Indy9. On opening the project for the first time I got a couple messages about properties that did not exist for the client - these did not return (for me to report to you) on any subsequent open. When attempting to compile, I get the following errors:
[Error] MultiFileDownloaderMain.pa s(235): E2009 Incompatible types: 'Parameter lists differ'
[Error] MultiFileDownloaderMain.pa s(236): E2009 Incompatible types: 'Parameter lists differ'
[Fatal Error] MultiFileDownloader.dpr(5) : F2063 Could not compile used unit 'MultiFileDownloaderMain.p as'
I downloaded and opened the project in D2005 with Indy9. On opening the project for the first time I got a couple messages about properties that did not exist for the client - these did not return (for me to report to you) on any subsequent open. When attempting to compile, I get the following errors:
[Error] MultiFileDownloaderMain.pa
[Error] MultiFileDownloaderMain.pa
[Fatal Error] MultiFileDownloader.dpr(5)
It seems that trying to open the zip file with winzip gives that error, however winrar was OK.
I compiled the source ok and only got a res file error when opening first time (no issue though).
:D
I compiled the source ok and only got a res file error when opening first time (no issue though).
:D
you are not using Indy 9
you are most likely using indy 10, that is why I have the demos in specific releases, 1 for each environment I actually own.
so, "Indy 9 Delphi 7" and "Indy 10 Delphi 5"
I have just made an Indy 10 demo also
goto the main site, and click on download for the appropriate version you have
you are most likely using indy 10, that is why I have the demos in specific releases, 1 for each environment I actually own.
so, "Indy 9 Delphi 7" and "Indy 10 Delphi 5"
I have just made an Indy 10 demo also
goto the main site, and click on download for the appropriate version you have
hmmm, maybe i should start zipping these up with an older pkzip just to be compatible with everyone. I use WinRar 8 for most things
ASKER
My errors even with package titled:
ASKER
I take it back - I DID get an error when opening the indy10 packaged app but it compiled fine and runs like a champ :)
Fantastic work as usual - now I just need to read it enough times to understand it. Kudos.
Fantastic work as usual - now I just need to read it enough times to understand it. Kudos.
ASKER
Loki,
If you are still watching this question, I would like to add pause and cancel functionality as well as cancel all downloads. I'm happy to open a new question but I would appreciate assistance if you see this.
If you are still watching this question, I would like to add pause and cancel functionality as well as cancel all downloads. I'm happy to open a new question but I would appreciate assistance if you see this.
A good way to learn is first write down on paper how you think it would work in just enlish
ie
get thread name
pause/stop thread
display this to user
or something
then from there look at writing the code as to how you think it would work, and then post here
just a suggestion =)
ie
get thread name
pause/stop thread
display this to user
or something
then from there look at writing the code as to how you think it would work, and then post here
just a suggestion =)
You cannot just "pause", so I'm guessing you mean, stop, but allow this to be continued (resumed) later.
note: not all servers support "resuming"
to "cancel" - all you need to do, is terminate the thread, and have the indy IdHTTP component stop somehow.
1 way to do this is raise an exception in the IdHTTP.OnWOrk event.
eg. in the IdHTTP.OnWork have some code like
if terminated then raise EUserAskedMeToCancel.creat e('cancell ing.') else....
( declared as: type EUserAskedMeToCancel = class Exception; // made my own exception to show cancelling )
This unfortunately means you will have to keep track of the thread
ie. instead of just
TIndyInAThread.create(....
you will need to have
IndyInAThread: TIndyInAThread;
..
IndyInAThread := TIndyInAThread.Create(...
so that you can just say "IndyInAThread.Terminate;" to cancel.
perhaps put this in a "StopDownload" procedure of TDownloadableFile
so to stop all, you would do
var
i: integer;
begin
for i := 0 to pred(DownloadableFileList. Count) do
TDownloadableFile(Download ableFileLi st[i]).Sto pDownload;
end;
Info I'm sure you'll want later...
To have Indy "resume" a download from a specifed point, you set the
Request.ContentRangeStart and Request.ContentRangeEnd values before you perform the GET()
It is possible to have 5 threads (for example) grabbing different parts of the same file. This is a common method to improve download speeds where servers throttle each connection. you have 5 connections, so you get the file faster. (assuming you have an internet connection faster than the server's "throttled" limit for each connection)
Note: some servers have caught on to this, and only allow 1 or 2 connections per IP adddress
Let me know if you want me to do a proper demo for you on this, but I know the above works
note: not all servers support "resuming"
to "cancel" - all you need to do, is terminate the thread, and have the indy IdHTTP component stop somehow.
1 way to do this is raise an exception in the IdHTTP.OnWOrk event.
eg. in the IdHTTP.OnWork have some code like
if terminated then raise EUserAskedMeToCancel.creat
( declared as: type EUserAskedMeToCancel = class Exception; // made my own exception to show cancelling )
This unfortunately means you will have to keep track of the thread
ie. instead of just
TIndyInAThread.create(....
you will need to have
IndyInAThread: TIndyInAThread;
..
IndyInAThread := TIndyInAThread.Create(...
so that you can just say "IndyInAThread.Terminate;"
perhaps put this in a "StopDownload" procedure of TDownloadableFile
so to stop all, you would do
var
i: integer;
begin
for i := 0 to pred(DownloadableFileList.
TDownloadableFile(Download
end;
Info I'm sure you'll want later...
To have Indy "resume" a download from a specifed point, you set the
Request.ContentRangeStart and Request.ContentRangeEnd values before you perform the GET()
It is possible to have 5 threads (for example) grabbing different parts of the same file. This is a common method to improve download speeds where servers throttle each connection. you have 5 connections, so you get the file faster. (assuming you have an internet connection faster than the server's "throttled" limit for each connection)
Note: some servers have caught on to this, and only allow 1 or 2 connections per IP adddress
Let me know if you want me to do a proper demo for you on this, but I know the above works
ASKER
TheRealLoki:
In the interest of making sure this is done right, I've opened a new question. it is here:
https://www.experts-exchange.com/questions/21875700/best-way-to-implement-a-download-manager-extension-2.html
Your work is excellent and I hope you will be able to update your demo with this new functionality (just cancellation, not pause / resume)
I am working in d2005 with indy10
In the interest of making sure this is done right, I've opened a new question. it is here:
https://www.experts-exchange.com/questions/21875700/best-way-to-implement-a-download-manager-extension-2.html
Your work is excellent and I hope you will be able to update your demo with this new functionality (just cancellation, not pause / resume)
I am working in d2005 with indy10
ASKER