HOWTO: Transfer compression in SFTP and SSH Shell

  |   Lukas Pokorny

A feature that is requested very often is integrated transfer compression in Rebex SFTP. This is particularly useful when transferring text files or other highly compressible files, and a similar feature is already included in Rebex FTP. So why does it take so long to add this to SFTP as well? The problem is that the .NET Framework compression API is well-suited to be used in protocols utilizing stream transfer modes such as FTP, but entirely unsuitable for protocols using block transfer mode such as SSH, the underlying protocol used by SFTP.

Built-in ZLIB compression support was introducted in build 3588. How do we enable it? Just add few additional lines to your application:

C #:

Sftp sftp = new Sftp(); 
SshParameters parameters = new SshParameters(); 
parameters.Compression = true; 
sftp.Connect(hostname, password, parameters); 


Dim sftp As New Sftp 
Dim parameters As New SshParameters 
parameters.Compression = True 
sftp.Connect(hostname, password, parameters

In Rebex SSH Shell, an equivalent code can be used.