0 votes
by (120 points)

We are currently using an open source SFTP client and it is giving us a lot of issues. Here's what we are trying to do.

We have a windows service that runs and monitors a remote directory on a Linux server via SFTP. When it finds files of a certain type it downloads those files. This service runs 24/7 and checks for these file types on a 1500ms interval. In the event of loss of network connectivity our solution will need to continuously retry until a connect can be re-established. In the event of a file lock, it also needs to support a retry mechanism, either implicitly or through events, error-handling, and/or custom code. The files range in size from 100k to 15mb and may be 10-20k files a day.

Can Rebex SFTP help us?

Applies to: Rebex SFTP

1 Answer

0 votes
by (145k points)

Yes, I'm sure Rebex SFTP can help you. Although it doesn't support automated download retry or connection re-establish, these actions can easily be achieved by catching SftpException, checking its Status property and reacting accordingly.

In case of loss of network connectivity, the Status will be set to SftpExceptionStatus.ConnectionClosed. In case of a protocol error like a file lock, it will be set to SftpExceptionStatus.ProtocolError and SftpException's Code property can be used to determine what kind of SFTP protocol error occured.

10-12k files (100K to 15MB each) sounds like a lot. To get the highest speed out of Rebex SFTP, enable Sftp object's UseLargeBuffers option before connecting to the server:

sftp.Options |= SftpOptions.UseLargeBuffers; //(C#)

sftp.Options = sftp.Options Or SftpOptions.UseLargeBuffers; ' VB.NET

(where 'sftp' is an instance of Rebex.Net.Sftp)

This uses larger receive buffers at different levels (TCP/IP, SSH, SFTP), resulting in transfer speed increase.