Internet Direct (Indy) Version 9.0.2 Beta
TIdTCPConnection.WriteStream
Sends a stream of data to the peer connection.

procedure WriteStream(AStream: TStream; const AAll: boolean; const AWriteByteCount: Boolean); virtual;
Parameters
AStream: TStream
The stream to send to the peer connection.

const AAll: boolean = True
Write from the start of the stream. Default value is True.

const AWriteByteCount: Boolean = False
Write the stream sizew to the peer connection. Default value is False.

Description
WriteStream is a procedure used to send the contents of the TStream descendant specified in AStream to the peer connection.

AAll indicates that the stream should be positioned to the stream origin prior to sending stream data.

AWriteByteCount indicates that the Integer value containing the size of the stream should be written to the peer connection prior to the stream data. When AAll is true, this value reflects the size of the entire stream. When AAll is False, this value indicates the stream sixe from the current stream position to the end of the stream.

When AWriteByteCount is True, WriteInteger is called to send the stream size to the peer connection.

WriteStream calls BeginWork with the work mode wmWrite and the size of the stream prior to sending stream data to the peer connection.

Stream data is sent to the peer in blocks, where each block can contain up to SendBufferSize bytes. Each block is read from the Indy buffer using ReadBuffer, and written to the peer connection using Write.

WriteStream calls EndWork with the work mode wmWrite prior to exiting from the method.