I don't really know what to do with TMemoryStream... i need TStringList ...
the site isn't that big, so it should be any problem... But i still don't
know how do i convert the recived stream to TStringList... ;-(

----- Original Message ----- 
From: "Francois Piette" <[EMAIL PROTECTED]>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Monday, April 18, 2005 9:23 AM
Subject: Re: Re[4]: [twsocket] Multithreaded http...


> > > in On requestDone:
> > > THttpCli(Sender).RcvdStream
>
> > But how do i convert it to StringList ?
>
> Convert the received stream to a string list ? Arno told you:
>     AStream.Seek(0, sofromBeginning);
>     StringList.LoadFromStream(AStream);
>
> But if you want to convert to a string list for analysis, it is probably
not the most efficient way
> to do that. You should probably use a TMemoryStream and direction use the
data in memory :
>
> var
>     P : PChar;  // Will point to HTML data (or whatever data you received)
>     N : Integer; // Will contains the number of bytes
> begin
>     P := PChar((THttpCli(Sender).RcvdStream as TMemoryStream).Memory);
>     N := THttpCli(Sender).RcvdStream.Size;
>     // Now you can use P and N to analyse the document received. Very
fast.
>
> // Don't forget to free the stream when processing is done or you'll have
a memory leak.
>
> --
> [EMAIL PROTECTED]
> http://www.overbyte.be
>
>
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>
>



-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to