Changing the progress reporting interval of FTP and SFTP clients

To dig into the progress reporting interval of FTP and SFTP we first need to know what these terms are about and what is meant by the progress reporting interval of the clients?

What is FTP?

FTP stands for File Transfer Protocol. It gives a way to transfer files from your computer to online servers. It allows you to send and download files to your computer to the server. It is an old protocol, and it’s widely used for sending and receiving files by the server. You can easily access files and its subdirectories on the server by using it. Mostly super users need it when it comes to uploading data to their web hostings or manage files on their sites. You can do the following operations to the remote items on the server:

  • Download
  • Upload
  • Delete
  • Rename
  • Move
  • Copy

Some servers also support setting permissions and attributes operations.

What is SFTP?

SFTP stands for Secure File Transfer Protocol. It is another file transfer protocol like FTP, but it provides the facility of a secure connection. It uses Secure Shell (SSH) data stream to transfer files over the Internet. In SFTP client must need to authenticated by the server, and data must be transferred through the secure channel because SFTP uses secure protocols to transfer files. SFTP is an extended version of SSH 2.0 which was designed by the Internet Engineering Task Force (IETF) to allow transferring files over SSH and TLS (Transport Layer Security) securely. Commands and data both are encrypted to transfer secure information between server and client. SCP is also used to copy files from the client to SSH servers and vice versa. There are many other protocols, such as HTTPS, POP, IMAP, SCP, etc.

It provides wide range of operations to be performed on remote files that are following:

  • Resume Halted(abrupt) Transfers.
  • Directory Listings.
  • Remote File Removal
  • Upload
  • Download
  • Delete
  • Check files and directories

ComponentPro provides the FTP and SFTP .NET libraries to easily integrate FTP and SFTP into your web, mobile, and desktop applications. These libraries are fast, reliable, easy to use, and feature-rich. You can use it to upload, download, create, delete the files, and much more. Here is the FTP library and SFTP library. You can check these libraries by downloading it. After downloading and installing these libraries into your computer, you can find the demos and examples in folders <Installed_Folder>\Samples\Ftp and <Installed_Folder>\Samples\Sftp. Here you will find plenty of ready-to-use FTP and SFTP examples for your web, mobile and desktop applications.

Now we talk about the progress reporting interval of FTP and SFTP client. You can use this in these libraries to implement progress reporting interval.

Progress Reporting Interval

The static ProgressReportInterval property of the FileSystem class introduced in v5.2 can help you reduce the number of calls to your Progress event handlers. As a result, it can make your program run faster. To disable the Progress reporting timing, you can set the ProgressReportInterval property to 0 (zero) meaning the Progress event is always raised whenever there is data transferred while uploading or downloading files. The default value is 100 ms - it is fired every 100 ms. The following example shows you how to set that property:

// Create a new instance.
Sftp client = new Sftp();
// Connect to the SFTP server.
// Authenticate.
client.Authenticate("username", "password");
// ...
// Set the progress report interval
ComponentPro.IO.FileSystem.ProgressReportInterval = 500; // Fire the Progress event every 500ms
// Upload all files and subdirectories from local folder 'c:\temp' to the remote dir '/temp'
client.UploadFiles("c:\\temp", "/temp");
// ...
// Disconnect.

45-Day Money Back Guarantee

We will refund your full money in 45 days
if you are not satisfied with our products

Buy Now

Dont miss out Get update on new articles and other opportunities