Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Oct : Doubt about stream descendant and idHTTP...
| Subject: | Doubt about stream descendant and idHTTP... |
| Posted by: | "PGS" (pgueva..@lartec.es) |
| Date: | Tue, 10 Oct 2006 16:02:55 |
Hi all,
Following with a previous exposition about idhttp and streaming, I have
tried the solution of overriding the write method of a TMemoryStream
descendant (to avoid writing the "read" and "seek" methods), but the result
is not the desired. The problem is that the write method is not executed
until de "GET" request is finished so "on-the-fly" processing is not
possible. My code, more or less, look like this:
TMyStream = class (TMemoryStream)
public
function Write(const ABuffer; ACount : LongInt) : LongInt; Override;
end;
Function TMyStream.Write(const ABuffer; ACount : LongInt) : LongInt;
Begin
Inherited Write(ABuffer, ACount);
// My code for processing the buffer.
End;
This stream is used within a thread:
Procedure MyThread.Execute;
Var
Strm : TMyStream;
Begin
// Initialization.
While not Terminated do
begin
HTTP.Get(URL, Strm); // HTTP is created out of the thread;
end;
End;
As I said, the write method is executed just after the http GET request is
finished, but if used with an URL which delivers streaming, this is, the GET
request does not finish, the write method never is called.
Please, let me know any suggest or solution to solve this problem.
Thanks in advance.