PowerTCP FTP for .NET
Ftp Class
Members 



The Ftp Component provides comprehensive file copy services to and from any File Transfer Protocol (FTP) server.
Object Model
Ftp ClassTcpBase ClassFeatures ClassFtpSession Class
Syntax
Public Class Ftp 
   Inherits ComponentBase
Dim instance As Ftp
public class Ftp : ComponentBase 
public ref class Ftp : public ComponentBase 
Remarks

The Ftp component provides high-level FTP capabilities to your application, including the ability to transfer files and streams, and the ability to read/write to the data connection. The ability to send any command (including proprietary commands) is supported. These capabilities are all encapsulated by high-level methods, so no knowledge of low-level protocols is required. Multithreading techniques are fully supported.

Using the Ftp Component

Some short descriptions of common usage scenarios follows. For a more complete description, see the reference section pages.

Connecting and Logging in: Before any communication with the server can take place, Session.RemoteEndPoint, FtpSession.Username, and FtpSession.Password must first be set. Once set, whenever communication needs to occur with the server, the client will automatically connect and log in. The client will stay logged in until the Ftp component is destroyed or Close or Abort is called.

For more information about logging in and out, see the FtpSession page.

Synchronous Use: All methods are synchronous: methods will not return until the action is complete.

Asynchronous Use: For use with Windows forms applications, the Start method starts a worker thread upon which methods may be called without interfering with UI thread message processing. Marshaling of data to the UI thread is achieved using the Marshal method, which raises an event on the UI thread.

For more information see the topic "Windows Forms Applications (Async Use)."

Transferring files: Files are retrieved using 4 overloaded Get methods and stored using 4 overloaded Put methods. These methods include overloads to support the transfer of multiple files (see Get(List<ListEntry>,String,String,Synchronize) and Put(List<FileSystemInfo>,String,String,Synchronize)).

For more information about copying files, see the reference pages.

Transferring streams: Files can be retrieved into streams using the Get(String,Int64,Stream) overload (by passing in a destination stream), and streams can be stored to the server as files using the Put(Stream,String,Int64,StoreType) overload (by passing in a source stream).

Reading/Writing to the data stream: The Ftp component can be used to read and write to a data stream (that reads/writes from/to a socket). See the Get(String,Int64) and Put(String,Int64,StoreType) overloads.

For more information about reading and writing to the data stream, see the Data class.

Sending commands: Commands are sent in two ways using the Ftp component. The first is when they are encapsulated by a high-level method. For example, the Rename method encapsulates the sending of the RNFR (rename from) and RNTO (rename to) commands. Other high-level commands include GetSize (issues the SIZE command and parses the response), GetDirectory (issues a PWD and parses the response), and List returns an encapsulated listing. The second is when commands are explicitly sent using the Send(String) method. Use this method to send any command not included in any higher level method (including proprietary commands).

Retrieving info about the control connection: The TCP control connection is exposed through the Connection property, allowing access to low-level properties and methods. This can be used to view TCP-level activity such as the local and remote IP address.

Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         Dart.Ftp.ComponentBase
            Dart.Ftp.Ftp

See Also

Reference

Ftp Members
Dart.Ftp Namespace


PowerTCP FTP for .NET Documentation Version 6.1
© 2023 Dart Communications. All Rights Reserved.
Send comments on this topic