edtFTPnet/PRO - Secure FTP component for .NET | Free Trial | Pricing
Extension to FTPConnection providing advanced features including multi-file operations, asynchronous programming methods, visual design tools and support for SOCKS proxies.

Namespace: EnterpriseDT.Net.Ftp
Assembly: edtFTPnetPRO (in edtFTPnetPRO.dll) Version: 9.4.0.40

Syntax

C#
[SerializableAttribute]
public class ExFTPConnection : FTPConnection, 
	ICloneable, IXmlSerializable, ISerializable
Visual Basic
<SerializableAttribute> _
Public Class ExFTPConnection _
	Inherits FTPConnection _
	Implements ICloneable, IXmlSerializable, ISerializable
Visual C++
[SerializableAttribute]
public ref class ExFTPConnection : public FTPConnection, 
	ICloneable, IXmlSerializable, ISerializable

Remarks

ExFTPConnection provides a range of advanced features that save development time and improve the quality of applications using FTP. These features include:

  • Multi-file operations: - Methods such as DownloadMultiple(String, String) and DeleteDirectoryTree(String) enable the developer to execute FTP operations on multiple files and directories with a single line of code.
  • Asynchronous methods: - These are virtually essential when writing GUI application since they vastly improve responsiveness by executing time-consuming FTP operations in the background.
  • Visual design tools: - ExFTPConnection integrates with Visual Studio and other IDEs to provide design-time tools that make FTP development easier. For example, the Connection Tester allows the developer to test their ExFTPConnection properties by connecting to an FTP server from within the development environment.
  • Proxy support: - FTP operations may be performed through SOCKS4, SOCKS4A, SOCKS5 and HTTP proxies.

ExFTPConnection also provides the connectivity for our range of FTP Visual Controls, which are .NET GUI Controls that can be dropped onto Windows Forms to add sophisticated visual FTP application features with virtually no programming.

Multi-file Operations are methods that operate on multiple files. Operations that can be done of multiple files are:

FTP and FTPS (unlike SFTP) have certain characteristics that can sometimes cause problems when transferring a large number of files in a short time. ExFTPConnection can be configured to avoid these problems by means of the MultiTransferSleepEnabled, MultiTransferCountBeforeSleep and MultiTransferSleepTime properties.

Asynchronous Methods are supported by means of a large number of Begin___() and End___() methods. Nearly every synchronous method offered in FTPConnectionand ExFTPConnection has matching asynchronous operations in the form of a matching Begin___() and End___() pair of methods. The following example illustrates the use of BeginDownloadFile(String, String, AsyncCallback, Object)

 Copy imageCopy
              private void button1_Click(object sender, System.EventArgs e)
              {
                exFTPConnection1.BeginDownloadFile(fileName, fileName, new AsyncCallback(DownloadComplete), fileName);
              }
            
              private void DownloadComplete(IAsyncResult ar)
              {
                exFTPConnection1.EndDownloadFile(ar);
                label1.Text = "Finished downloading " + (string)ar.AsyncState;
              }
            
The button1_Click method initiates the download using the BeginDownloadFile(String, String, AsyncCallback, Object) method and returns immediately (i.e. before the file has been downloaded). The DownloadComplete method is then called once the file has been downloaded allowing us to notify the user of this fact. Since the download happens in the background the application may perform other processing while the file is being downloaded.

Each Begin___() method returns an IAsyncResult reference, which may be cast to FTPTask. FTPTask contains an identifier called TaskID, which uniquely identifies the method-call. Information about the task may also be obtained through this object. The task may be cancelled by calling the CancelTask(IAsyncResult) method with the given task ID.

When Concurrent transfers are [!:ConcurrentTransferSettings.Enabled] multiple files may be transferred at the same time. This is achieved by maintaining a set of connections (called a "connection pool"). Each connection in the pool may transfer one file at a time, so the maximum number of files that may be transferred simultaneously is equal to the size of the pool ([!:ConcurrentTransferSettings.MaxConnections].

The Connection Tester may be used to assist with setting the properties of ExFTPConnection. It allows the developer to test various property-settings interactively without running their application. The Connection Tester may be accessed by (1) double-clicking on the component, (2) right-clicking on the component and selecting "Connection Designer" from the context menu, or (3) selecting the component and then clicking on the "Connection Tester" link at the bottom of the Properties View.

Proxy Settings may be controlled through the ProxySettings property.

Inheritance Hierarchy

See Also