Xceed .NET Libraries Documentation
ComputeStreamBufferSize Method (SFtpSession)


Xceed.SSH.Client Assembly > Xceed.SSH.Client Namespace > SFtpSession Class : ComputeStreamBufferSize Method
Computes the optimal buffer size for SFtp file transfers on the specified stream.
Overload List
OverloadDescription
 
 
Remarks

This method is useful when performing manual SFtp file transfers (see example below). The method is used by SFtpFile when it is used as a destination for a file transfer.

If stream is a null reference (Nothing in Visual Basic) or is not a SFtp write stream, a good buffer size will still be computed without error as the stream information is just part of the computation. It is fine to use the returned value in that situation.

SSH has overhead and several rules where the server defines a maximum logical packet size.

Any reasonable buffer size can be used when writing to a SFtp stream, it will work. However, using a value too small will generate more overhead than needed. Using a value that is too large will force the component to split the data into several packets and increase overhead as well.

This method computes the optimal buffer size for the specified SFtp stream. It takes into account the effective overhead packets will take and computes a value that will make it so that every call to Stream.Write() will end up creating the biggest SSH packet allowed by the server that does not generate extra overhead.

This provides the best throughput in a file transfer where a SFtp stream is the destination.

Example
Performing a manual upload
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

SFtpSession Class
SFtpSession Members