>________________________________
>From: Piotr Polok <top...@polok.pl>
>To: Ararat Synapse <synalist-public@lists.sourceforge.net>
>Sent: Thursday, July 21, 2011 2:40 AM
>Subject: Re: [Synalist] THTTPSend GET slower than wget
>
>On Wed, 20 Jul 2011 10:22:59 -0700 (PDT), Leonardo M. Ramé wrote:
>> Hi, I'm using THTTPSend to retrieve some files of ~10mb in size
>> aprox. using GET method. As it felt slow, I did some tests using wget
>> and curl to call the same urls and found THTTPSend takes almost twice
>> the time of the other utilities.
>>
>> I use this code to get the files:
>>
>> lHttp := THTTPSend.Create;
>> lHttp.Sock.OnHeartbeat:=@HeartBeat;
>> lHttp.Sock.HeartbeatRate := 5000;
>> if lHttp.HTTPMethod('GET', FUrl) then
>> begin
>>     lHttp.Document.Position:= 0;
>>     // do something with Document
>> end;
>> lHttp.Free;
>
>HI Leonardo,
>
>Could you please explain (or send a code) how do you use '@HeartBeat'.
>


A simple example could be:

1 - Create a TForm with a button, then in the button's onClick event handler 
copy the code above.
2 - Create this method:

TForm1.HeartBeat(Sender: TObject);
var
  lBlkSock: TBlockSocket;
  lDownloaded: Integer
begin
  lBlkSock := TBlockSocket(Sender);
  lDownloaded:= lBlkSock.RecvCounter;
  Self.Caption := Format('%d', [lDownloaded]);

end;

That's all.

------------------------------------------------------------------------------
5 Ways to Improve & Secure Unified Communications
Unified Communications promises greater efficiencies for business. UC can 
improve internal communications as well as offer faster, more efficient ways
to interact with customers and streamline customer service. Learn more!
http://www.accelacomm.com/jaw/sfnl/114/51426253/
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to