Internet Direct (Indy) Version 9.0.2 Beta
|
procedure OpenWriteBuffer(const AThreshhold: Integer);
AThreshold indicates the number of bytes that can accumulate in the Indy write buffer prior to using FlushWriteBuffer. The write buffer threshold is used to provide optimium data transfer without creating massive in memory buffers, or requiring the caller to periodically flush the buffer. When the write buffer size exceeds the threshold value, the connection will send a packet containing buffered data. The default value of AThreshold (-1) indicates that write buffering should be used for the entire write buffer. FlushWriteBuffer may also use a threshold value to determine the data packet size commited to the peer socket connection from the Indy internal buffer.
Use OpenWriteBuffer in a try...except block, like the following:
OpenWriteBuffer; try; WriteStream(AStream); // Close the write buffer and have Indy now transmit it CloseWriteBuffer; except // Clear what we had buffered, and disable write buffering CancelWriteBuffer; // Re-raise the exception so it is not masked raise; end;