You can either:
Use
RawToBytes()
to copy the buffer data to aTIdBytes
and then pass that toTIdIOHandler.Write(TIdBytes)
:Connection.IOHandler.Write(RawToBytes(Buffer^, BufferSize));
Use
TIdMemoryBufferStream
to wrap the buffer in aTStream
and pass that toTIdIOHandler.Write(TStream)
:Strm := TIdMemoryBufferStream.Create(Buffer, BufferSize); Connection.IOHandler.Write(Strm); Strm.Free;