Re: [twsocket] Download manager (Source) (Missing files?)
Only trying to figure out, where the THttpCli component is located, cause I'm not finding it. Not even finding that download manager queue thing within the source. The browser demo is slightly convoluted due to handling URL protocols such as res and file, as well as http, and due to caching of images. Essentially, there is a dynamic array FImageHTTPs of TImageHTTP components, four at the moment, this component is defined in urlconics.pas and includes HTTP : TSslHttpCli which does the hard work. When the browser component needs to display an image in GetImageRequest, the URL is added to a queue Pending and a windows message WM_Next_Image sent, which eventually causes WMNextImage to be called. This checks if one of the FImageHTTPs instances is free and if so starts a download. When the download completes, ImageRequestDone is called which processes the download and calls HttpSessionFree. This clears the last session and checks Pending for any more URLs and sends another windows message to trigger the next download. So Pending is the real queue. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Download manager (Source) (Missing files?)
Thanks. Sorry if there are multiple messages coming through for me, my Provider had blocked this e-mail address (twsocket) thinking it was spam. Perry -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Angus Robertson - Magenta Systems Ltd Sent: Tuesday, April 24, 2012 2:00 AM To: twsocket@elists.org Subject: Re: [twsocket] Download manager (Source) (Missing files?) Only trying to figure out, where the THttpCli component is located, cause I'm not finding it. Not even finding that download manager queue thing within the source. The browser demo is slightly convoluted due to handling URL protocols such as res and file, as well as http, and due to caching of images. Essentially, there is a dynamic array FImageHTTPs of TImageHTTP components, four at the moment, this component is defined in urlconics.pas and includes HTTP : TSslHttpCli which does the hard work. When the browser component needs to display an image in GetImageRequest, the URL is added to a queue Pending and a windows message WM_Next_Image sent, which eventually causes WMNextImage to be called. This checks if one of the FImageHTTPs instances is free and if so starts a download. When the download completes, ImageRequestDone is called which processes the download and calls HttpSessionFree. This clears the last session and checks Pending for any more URLs and sends another windows message to trigger the next download. So Pending is the real queue. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Download manager (Source) (Missing files?)
I have the Delphi XE2 Pro installed, and when I load this project it's telling me that htmlicons.inc is missing along with THMTLviewer component, and Htmlview, HTMLUn2 are missing. What is missing from this demo? You have not read the requirements at the top of the main unit FBUnitIcs.pas: This demo requires the HtmlViewer component from: https://github.com/BerndGabriel/HtmlViewer or http://code.google.com/p/thtmlviewer/ which must also be downloaded and installed before the demo can be built. It also needs ICS v7 dated 1st April 2012 or later from: http://wiki.overbyte.be/wiki/index.php/ICS_Download You can also download HtmlViewer from the above ics_download page. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Download manager (Source) (Missing files?)
Yes, I found it, that's why I sent a message right afterwards, this message came much later then my 2nd message. Got it to work.. Only trying to figure out, where the THttpCli component is located, cause I'm not finding it. Not even finding that download manager queue thing within the source. -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Angus Robertson - Magenta Systems Ltd Sent: Monday, April 23, 2012 2:10 AM To: twsocket@elists.org Subject: Re: [twsocket] Download manager (Source) (Missing files?) I have the Delphi XE2 Pro installed, and when I load this project it's telling me that htmlicons.inc is missing along with THMTLviewer component, and Htmlview, HTMLUn2 are missing. What is missing from this demo? You have not read the requirements at the top of the main unit FBUnitIcs.pas: This demo requires the HtmlViewer component from: https://github.com/BerndGabriel/HtmlViewer or http://code.google.com/p/thtmlviewer/ which must also be downloaded and installed before the demo can be built. It also needs ICS v7 dated 1st April 2012 or later from: http://wiki.overbyte.be/wiki/index.php/ICS_Download You can also download HtmlViewer from the above ics_download page. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Download manager (Source)
Nevermind, was missing the htmlviewer component. Got it to work now, but trying to find out where those THttpCli are located. -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Angus Robertson - Magenta Systems Ltd Sent: Wednesday, April 18, 2012 11:33 AM To: twsocket@elists.org Subject: Re: [twsocket] Download manager (Source) Working now with the THttpCLI component instead. Got most of it to work now.. But have no clue where the data is put when the download is finished. The new web browser demo project now illustrates an HTML download queue, each image on a web page is queued and then downloaded using four THttpCli components, with the next download triggered when the last one completes. The demo is in folder delphi\internet\browser of the nightly V7 zip file. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Download manager (Source) (Missing files?)
Hmm. Maybe I am missing something here. I have the Delphi XE2 Pro installed, and when I load this project it's telling me that htmlicons.inc is missing along with THMTLviewer component, and Htmlview, HTMLUn2 are missing. What is missing from this demo? Perry -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Angus Robertson - Magenta Systems Ltd Sent: Wednesday, April 18, 2012 11:33 AM To: twsocket@elists.org Subject: Re: [twsocket] Download manager (Source) Working now with the THttpCLI component instead. Got most of it to work now.. But have no clue where the data is put when the download is finished. The new web browser demo project now illustrates an HTML download queue, each image on a web page is queued and then downloaded using four THttpCli components, with the next download triggered when the last one completes. The demo is in folder delphi\internet\browser of the nightly V7 zip file. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Download manager
Working now with the THttpCLI component instead. Got most of it to work now.. But have no clue where the data is put when the download is finished. There are several demo projects supplied with ICS that illustrate use of the HTTP client component, OverbyteIcsHttpGet is probably most appropriate for you, it does this: HttpCli1.RcvdStream := TFileStream.Create(FileNameEdit.Text, fmCreate); A few weeks ago I wrote some code for downloading a list of URLs, specifically the images for a web page being displayed by HtmlViewer (a free web browser component). I'll look to update one of the HtmlViewer demo projects with ICS, to illustrate downloading and the HTTP client component. It is very pretty to see multiple images on a web page (in my case HTML email) appear before your eyes from your own code. But I won't have time for a couple of weeks. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Download manager
I am working on a download manager, and using the HTTPMultipartdownloader component. For now I have 5 different HTTPMultipartdownloader components on my form, but I think I should be able to do it with only 1. like HTTPMultipartdownloader[xx] ? It depends on the requirements for your application. A few questions: 1) Do you want to download several files simultaneously or sequentially ? 2) To download one single file, do you want to download it normally or use the several simultaneous connection to download several parts of the same file at the same time ? Question 1 will tell you if you need one (sequential download) or many (parallel download) components. Question 2 will tell you is you need the THttpCli component (normal download) or the MultipartHTTP component (sevral parts of the same file simultaneously. Actually the multipart component is using several THttpCli component to download several parts of the same file at the same time using the HTTP range option. This is useful when you have a host server with a simple bandwidth limitation. Using the multipart component, you'll go much faster. If the host server has an intelligent bandwidth limiter, this won't change anything and if it has no bandwidth limiter, you'll actually slow down the download. Also don't forget that if you download 10 files simultaneously, each one with 10 simultaneous parts, you'll end up with ONE HUNDRED simultaneous connections. Thinks about the required power on your client computer and network infrastructure. By the way, when using appropriate hardware and OS, ICS is able to handle several THOUSANDS simultaneous connections. This won't work with all configurations because of OS or hardware limitation. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Download manager
If I have 5 or more different weblinks in my queue, I want do download all these files. Now I am using 5 components, but it doesn't seem very practical. Basicly i have 5 of them called DL1, DL2, DL3 , DL4 and DL5. Is there an easier way to accomplish this? to use just like a HTTPMultipartdownloader[xx] ? HTTPMultipartdownloader is designed to download a very large single file in several parts using multiple connections to the web server, and assumes you have a lot of bandwidth. The normal THttpCli component is fine for most downloading, but don't drop them on the form, instead create them in code as a array and assign all the properties and events in code, using the same events for all instances of the component (this is what HTTPMultipartdownloader does itself). var MyHTTPCli: array [0..9] of THttpCli; procedure onHttpDataEvent (Sender : TObject; Buffer : Pointer; Len : Integer); procedure onHttpCommand (Sender: TObject; var S: String) ; procedure onHttpHeaderData (Sender : TObject); procedure onHttpSessionConnected (Sender : TObject); for I := 0 to 9 do begin MyHTTPCli [I] := THTTPCli.Create (Self) ; with MyHTTPCli [I] do begin Tag := I ; // so we can identify each instance OnDocData := onHttpDataEvent ; OnCommand := onHttpCommand ; OnHeaderData := onHttpHeaderData ; OnSessionConnected := onHttpSessionConnected ; etc, etc, end ; end ; Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Download manager
Perry Kappetein wrote: Hello, First of all, I am new to this list, and wasn't aware that there was a mailinglist available. Hopefully someone is able to help me with this. I am working on a download manager, and using the HTTPMultipartdownloader component. For now I have 5 different HTTPMultipartdownloader components on my form, but I think I should be able to do it with only 1. like HTTPMultipartdownloader[xx] ? One instance of TMultipartHttpDownloader can handle one download. If you want to access multiple instances by index create a TList or TComponentList at run time and add your instances once on program start. Access the instances with a type cast like TMultipartHttpDownloader(MyList[0]) or derive your custom TComponentList that accepts and returns TMultipartHttpDownloader objects rather than TComponent. Hello, starting with D2009 or D2010 you can also use the generic TObjectList from Generics.Collections and save those typecasts: vas MyList:TObjectListHTTPMultipartdownloader; begin MyList := TObjectListHTTPMultipartdownloader.Create(true); // create one downloader and add it... [..] MyList.Add(MyHTTPMultipartdownloader); // create one downloader... [..] MyList.Add(MyHTTPMultipartdownloader); // use them MyList[2].Tag := 4711; end; Greetings Markus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Download manager
Thank you all for your information. Working now with the THttpCLI component instead. Got most of it to work now.. But have no clue where the data is put when the download is finished. With the HTTPMultipartdownloader I can use a Filestream, but do not see that in the THttpCLI component ? Perry The normal THttpCli component is fine for most downloading, but don't drop them on the form, instead create them in code as a array and assign all the properties and events in code, using the same events for all instances of the component (this is what HTTPMultipartdownloader does itself). var MyHTTPCli: array [0..9] of THttpCli; procedure onHttpDataEvent (Sender : TObject; Buffer : Pointer; Len : Integer); procedure onHttpCommand (Sender: TObject; var S: String) ; procedure onHttpHeaderData (Sender : TObject); procedure onHttpSessionConnected (Sender : TObject); for I := 0 to 9 do begin MyHTTPCli [I] := THTTPCli.Create (Self) ; with MyHTTPCli [I] do begin Tag := I ; // so we can identify each instance OnDocData := onHttpDataEvent ; OnCommand := onHttpCommand ; OnHeaderData := onHttpHeaderData ; OnSessionConnected := onHttpSessionConnected ; etc, etc, end ; end ; Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Download manager (Source)
Hi, I am stuck now for weeks on this, and even though with some help I am unable to figure out what I am missing. Could someone take a look at this, and tell me what I am missing or doing wrong? The file is located here: http://www.dsromorganizer.com/helpneeded.zip Basicly what doesn't work right is When I Abort the download, whatever is left showing in the queue are not the right ones. Also I am unable to get the progressbar to work at all. Not sure If I created it the wrong way ? Thank you so much for all your help Perry -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Download manager
Hello, First of all, I am new to this list, and wasn't aware that there was a mailinglist available. Hopefully someone is able to help me with this. I am working on a download manager, and using the HTTPMultipartdownloader component. For now I have 5 different HTTPMultipartdownloader components on my form, but I think I should be able to do it with only 1. like HTTPMultipartdownloader[xx] ? If I have 5 or more different weblinks in my queue, I want do download all these files. Now I am using 5 components, but it doesn't seem very practical. Basicly i have 5 of them called DL1, DL2, DL3 , DL4 and DL5. Is there an easier way to accomplish this? to use just like a HTTPMultipartdownloader[xx] ? This is what I have right now where DL1 is the component. and a listview that contains the weblink + filelocation. procedure TMultipartHttpDownloadForm.Button4Click(Sender: TObject); var x : integer; begin x:=0; while x = listview.items.Count -1 do begin if (dl1.FileStream = nil) and (x = listview.items.Count -1) then begin bar1.Clear; dl1.URL := listview.Items[0].Caption; dl1.StateFileName := listview.Items[0].SubItems[0] + '.Status'; dl1.PartCount := 2; dl1.FileStream:= TFileStream.Create(listview.Items[0].SubItems[0], fmCreate); inc(x); dl1.Start; end; application.ProcessMessages ; end; end; Thank you Perry -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Download manager
Perry Kappetein wrote: Hello, First of all, I am new to this list, and wasn't aware that there was a mailinglist available. Hopefully someone is able to help me with this. I am working on a download manager, and using the HTTPMultipartdownloader component. For now I have 5 different HTTPMultipartdownloader components on my form, but I think I should be able to do it with only 1. like HTTPMultipartdownloader[xx] ? One instance of TMultipartHttpDownloader can handle one download. If you want to access multiple instances by index create a TList or TComponentList at run time and add your instances once on program start. Access the instances with a type cast like TMultipartHttpDownloader(MyList[0]) or derive your custom TComponentList that accepts and returns TMultipartHttpDownloader objects rather than TComponent. -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be