[twsocket] THttpCli simultaneous

2008-08-11 Thread crazdcodr
I'd like to use THttpCli to do multiple simultaneous "GET" requests of
different websites. All of the retrieved HTML documents need to be saved
to the harddrive.
When dynamically creating each of the THttpCli components, should I issue
"GetAsync" and write the data to disk in the OnDocData event? Or, should
I just create a file stream with RcvdStream and issue a normal "Get"?

-- 
Be Yourself @ mail.com!
Choose From 200+ Email Addresses
Get a Free Account at www.mail.com

-- 
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] THttpCli simultaneous

2008-08-11 Thread Francois Piette
> I'd like to use THttpCli to do multiple simultaneous "GET" requests of
> different websites. All of the retrieved HTML documents need to be saved
> to the harddrive.
> When dynamically creating each of the THttpCli components, should I issue
> "GetAsync" and write the data to disk in the OnDocData event? Or, should
> I just create a file stream with RcvdStream and issue a normal "Get"?

GetAsync is the way to go. You can use RcvdStream with GetAsync. Be sure to
use a different stream for each component !

--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
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] THttpCli simultaneous

2008-08-11 Thread crazdcodr
 So I should issue GetAsync and handle RcvdStream in the OnDocData event,
correct?


  - Original Message -
  From: "Francois Piette"
  To: "ICS support mailing"
  Subject: Re: [twsocket] THttpCli simultaneous
  Date: Mon, 11 Aug 2008 11:56:42 +0200


  > I'd like to use THttpCli to do multiple simultaneous "GET" requests
  of
  > different websites. All of the retrieved HTML documents need to be
  saved
  > to the harddrive.
  > When dynamically creating each of the THttpCli components, should I
  issue
  > "GetAsync" and write the data to disk in the OnDocData event? Or,
  should
  > I just create a file stream with RcvdStream and issue a normal
  "Get"?

  GetAsync is the way to go. You can use RcvdStream with GetAsync. Be
  sure to
  use a different stream for each component !

  --
  [EMAIL PROTECTED]
  Author of ICS (Internet Component Suite, freeware)
  Author of MidWare (Multi-tier framework, freeware)
  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

-- 
Be Yourself @ mail.com!
Choose From 200+ Email Addresses
Get a Free Account at www.mail.com

-- 
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] THttpCli simultaneous

2008-08-11 Thread Francois PIETTE
Using GetAsync and simultaneous download (one download per component 
instance) doesn't change anything.

--
[EMAIL PROTECTED]
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be

- Original Message - 
From: <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Monday, August 11, 2008 8:49 PM
Subject: Re: [twsocket] THttpCli simultaneous


> So I should issue GetAsync and handle RcvdStream in the OnDocData event,
> correct?
>
>
>  - Original Message -
>  From: "Francois Piette"
>  To: "ICS support mailing"
>  Subject: Re: [twsocket] THttpCli simultaneous
>  Date: Mon, 11 Aug 2008 11:56:42 +0200
>
>
>  > I'd like to use THttpCli to do multiple simultaneous "GET" requests
>  of
>  > different websites. All of the retrieved HTML documents need to be
>  saved
>  > to the harddrive.
>  > When dynamically creating each of the THttpCli components, should I
>  issue
>  > "GetAsync" and write the data to disk in the OnDocData event? Or,
>  should
>  > I just create a file stream with RcvdStream and issue a normal
>  "Get"?
>
>  GetAsync is the way to go. You can use RcvdStream with GetAsync. Be
>  sure to
>  use a different stream for each component !
>
>  --
>  [EMAIL PROTECTED]
>  Author of ICS (Internet Component Suite, freeware)
>  Author of MidWare (Multi-tier framework, freeware)
>  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
>
> -- 
> Be Yourself @ mail.com!
> Choose From 200+ Email Addresses
> Get a Free Account at www.mail.com
>
> -- 
> 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] THttpCli simultaneous

2008-08-12 Thread crazdcodr
 Is there a better method of doing this? If so, a small example would be
GREATLY appreciated.

procedure TForm1.ExecSimultaneous;
begin
for Item := 1 to CheckListBox1.Items.Count do begin
AHttpCli := THttpCli.Create(Self);
with AHttpCli do begin
MultiThreaded := True;
FHttpCliList.Add(AHttpCli);
Tag := Item;
URL := Trim(CheckListBox1.Items[Item-1]);
RcvdStream := TMemoryStream.Create;
AHttpCHeaderData := HttpCli1HeaderData;
AHttpCli.GetAsync
end
end
end;

procedure TForm1.HttpCli1HeaderData(Sender: T);
begin
with THttpCli(Sender) do begin
if StatusCode = 404 then begin
Abort;
URL := ChangeFileExt(URL, '.txt');
GetAsync;
Exit
end;
RequestDone := HttpCliItemRequestDone
end
end;

procedure TForm1.HttpCliItemRequestDone(
Sender : T;
RqType : THttpRequest;
Error : Word);
var
Item : Integer;
AHttpCli : THttpCli;
Count : Integer;
SL: TMemoryStream;
s: String;
begin
AHttpCli := Sender as THttpCli;

{ Remove the item form the list }
Count := FHttpCliList.Count;
for Item := 1 to Count do begin
if AHttpCli = FHttpCliList.Items[Item - 1] then begin
SL := TMemoryStream.Create;
SL.LoadFromStream(AHttpCli.RcvdStream);
SL.SaveToFile('c:\' + Copy(s, LastDelimiter('/', s) + 1, 999));
SL.Free;
AHttpCli.RcvdStream.Free;
FHttpCliList.Delete(Item - 1);
Break
end
end;

{ Free the item }
AHttpCli.Free;
end;



  - Original Message -
  From: "Francois PIETTE"
  To: "ICS support mailing"
  Subject: Re: [twsocket] THttpCli simultaneous
  Date: Mon, 11 Aug 2008 21:09:49 +0200


  Using GetAsync and simultaneous download (one download per component
  instance) doesn't change anything.

  --
  [EMAIL PROTECTED]
  The author of the freeware multi-tier middleware MidWare
  The author of the freeware Internet Component Suite (ICS)
  http://www.overbyte.be

  - Original Message -
  From:
  To: "ICS support mailing"
  Sent: Monday, August 11, 2008 8:49 PM
  Subject: Re: [twsocket] THttpCli simultaneous


  > So I should issue GetAsync and handle RcvdStream in the OnDocData
  event,
  > correct?
  >
  >
  > - Original Message -----
  > From: "Francois Piette"
  > To: "ICS support mailing"
  > Subject: Re: [twsocket] THttpCli simultaneous
  > Date: Mon, 11 Aug 2008 11:56:42 +0200
  >
  >
  > > I'd like to use THttpCli to do multiple simultaneous "GET"
  requests
  > of
  > > different websites. All of the retrieved HTML documents need to
  be
  > saved
  > > to the harddrive.
  > > When dynamically creating each of the THttpCli components, should
  I
  > issue
  > > "GetAsync" and write the data to disk in the OnDocData event? Or,
  > should
  > > I just create a file stream with RcvdStream and issue a normal
  > "Get"?
  >
  > GetAsync is the way to go. You can use RcvdStream with GetAsync. Be
  > sure to
  > use a different stream for each component !
  >
  > --
  > [EMAIL PROTECTED]
  > Author of ICS (Internet Component Suite, freeware)
  > Author of MidWare (Multi-tier framework, freeware)
  > 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
  >
  > -- Be Yourself @ mail.com!
  > Choose From 200+ Email Addresses
  > Get a Free Account at www.mail.com
  >
  > -- 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

-- 
Be Yourself @ mail.com!
Choose From 200+ Email Addresses
Get a Free Account at www.mail.com

-- 
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