Indy 9
Example
TIdTCPConnection.ClearWriteBuffer
      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;

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.