protected override void WriteBytes(SshDataStream stream)
{
const int sizeOfDataLengthBytes = 4;
var startPosition = stream.Position;
// skip 4 bytes for the length of the SFTP message data
stream.Seek(sizeOfDataLengthBytes, SeekOrigin.Current);
// write the SFTP message data to the stream
base.WriteBytes(stream);
// save where we were positioned when we finished writing the SSH message data
var endPosition = stream.Position;
// determine the length of the SSH message data
var dataLength = endPosition - startPosition - sizeOfDataLengthBytes;
// write the length of the SFTP message where we were positioned before we started
// writing the SFTP message data
stream.Position = startPosition;
stream.Write((uint) dataLength);
// move back to we were positioned when we finished writing the SFTP message data
stream.Position = endPosition;
}