Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Feb : Reading the data off a buffer.
| Subject: | Reading the data off a buffer. |
| Posted by: | "Graham Harris" (..@bmsgharr.globalnet.co.uk) |
| Date: | 21 Feb 2007 06:11:28 |
Hi
Using Indy 10.0.16 how do I determine the size of the input buffer? As
the buffer will be a stream of text. I could read in a loop all the
data, a byte at a time. But I would like to do something like:
procedure GetData(Socket: IdSocket; Data: TMemoryStream);
var
Buffer: TIdBytes;
BufferSize: integer;
begin
BufferSize := Socket.BufferSize;
SetLength(Buffer, BufferSize);
Socket.ReadBytes(Buffer, BufferSize, False);
Data.Write(Buffer[0], BufferSize);
end;
TIA
Graham Harris
--