[Lazarus] Get binary (byte by byte) from a HTTP host
silvioprog
silvioprog at gmail.com
Wed Jan 19 12:39:19 CET 2011
Thanks José. I'm implementing another simple demo, after I finish I share
here.
Thanks to all.
2011/1/18 José Mejuto <joshyfun at gmail.com>
> Hello Lazarus-List,
>
> Tuesday, January 18, 2011, 4:13:13 AM, you wrote:
>
> s> Not works, Document property always is empty in OnMonitor event. x(
>
> You can not access Document from OnMonitor, you can only access Socked
> properties/status.
>
> Synapse is blocking, so :
>
> 1) HTTPSend prepare headers.
> 2) HTTPSend GET
> 3) HTTPSend access document.
>
> Or in your code:
> ------------------------------------------------------
> procedure TMainForm.StartButtonClick(Sender: TObject);
> begin
> if FileExistsUTF8(CFile) then
> FFileStream := TFileStream.Create(CFile, fmOpenReadWrite)
> else
> FFileStream := TFileStream.Create(CFile, fmCreate);
> try
> FHTTPSend.Sock.MaxRecvBandwidth := 50;
> FHTTPSend.Clear;
> FHTTPSend.RangeEnd := FFileStream.Size;
> FFileStream.Position := FFileStream.Size;
> FHTTPSend.HTTPMethod('GET', CURL);
> //Now you can acess Document
> FFileStream.CopyFrom(FHTTPSend.Document, FHTTPSend.Document.Size);
> finally
> FFileStream.Free;
> end;
> end;
>
> procedure TMainForm.OnMonitor(Sender: TObject; Writing: Boolean;
> const Buffer: Pointer; Len: Integer);
> begin
> //Nothing...
> //FHHTPSend information at this point is undefined.
> end;
> --------------------------------------------------------
>
> s> Hm..., I think isn't possible resume download with Synapse, I tryed all
> but
> s> without sucess.
>
> What's the problem ? Paste headers sent and received headers. Resuming
> is not supported by all web servers.
>
> --
> Best regards,
> José
>
--
*Silvio Clécio*
*Cel.* (15) 9122-7768
*Blog.* blog.silvioprog.com.br
*Twitter.* twitter.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110119/93bfbdd7/attachment-0003.html>
More information about the Lazarus
mailing list