FTP is the abbreviation of File Transfer Protocol which is used to transfer file from one server to another. Using the Ultimate .NET FTP Library, you can download a single file or multiple remote files. Today we will go through all the steps to guide you on how to achieve that.
The file transfer protocol has a lot of command line options to manage remote items. However, here, we will discuss how you can use Ultimate FTP in your application to perform these operations.
When performing download/upload to FTP, network bandwidth is of utmost importance. Ultimate FTP offers a way to control bandwidth that restricts the amount of data transferred per second. In a shared network, when bandwidth usage for consumers is essential, the throttling feature let you adjust transfer speed on the fly to control the network bandwidth usage for each. Another case that the feature is useful is when stability is increased when we decrease the transfer speed.
Ultimate FTP allows you to download the remote file to either local disk or memory.
First, you need to add necessary references to Ultimate FTP, and import appropriate namespaces.
using ComponentPro; using ComponentPro.IO; using ComponentPro.Net;
Imports ComponentPro Imports ComponentPro.IO Imports ComponentPro.Net
The following code downloads the file from templates folder on the server, using FTP protocol, and saves it to local disk:
// Create a new class instance. Ftp client = new Ftp(); // Connect to the FTP server. client.Connect("localhost"); // Authenticate. client.Authenticate("user", "password"); // ... // Download remote file "templates\mytemplate.txt" to "c:\mytemplate.txt" client.DownloadFile(@"templates\mytemplate.txt", @"c:\mytemplate.txt "); // ... // Disconnect. client.Disconnect();
' Create a new class instance. Dim client As New Ftp() ' Connect to the FTP server. client.Connect("localhost") ' Authenticate. client.Authenticate("user", "password") ' ... ' Download remote file 'templates\mytemplate.txt' to 'c:\ mytemplate.txt' client.DownloadFile("templates\mytemplate.txt", "c:\ mytemplate.txt") ' ... ' Disconnect. client.Disconnect()