edtFTPnet/PRO - Secure FTP component for .NET | Free Trial | Pricing
Click or drag to resize

FTPConnection Class

Provides FTP client functionality.
Inheritance Hierarchy

Namespace:  EnterpriseDT.Net.Ftp
Assembly:  edtFTPnetPRO (in edtFTPnetPRO.dll) Version: 12.3.0.0
Syntax
public class FTPConnection : Component, 
	IFTPComponent, INotifyPropertyChanged

The FTPConnection type exposes the following members.

Constructors
  NameDescription
Public methodFTPConnection
Default constructor for FTPConnection.
Protected methodFTPConnection(FTPClient)
Create an FTPConnection using the given FTP client.
Public methodFTPConnection(IContainer)
Creates an instance of FTPConnection within the given container.
Top
Properties
  NameDescription
Public propertyAccountInfo
Account information string.
Protected propertyActiveClient
Reference to the currently active IFileTransferClient.
Public propertyActivePortRange
Specifies the range of ports to be used for data-channels in active mode.
Public propertyAutoFeatures
Determines if the component will automatically send the FEAT command.
Public propertyAutoLogin
Determines if the component will automatically log in upon connection.
Public propertyAutoPassiveIPSubstitution
Use AutoPassiveIPSubstitution to ensure that data-socket connections are made to the same IP address that the control socket is connected to.
Public propertyBuildTimestamp
The assembly's build timestamp.
Protected propertyCanRaiseEvents
Gets a value indicating whether the component can raise an event.
(Inherited from Component.)
Public propertyCloseStreamsAfterTransfer
Determines if transfer-methods taking Streams as arguments should close the stream once the transfer is completed.
Public propertyCommandEncoding
The character-encoding to use for FTP control commands and when dealing with file- and directory-paths.
Public propertyConnectMode
The connection-mode (passive or active) of data-channels.
Public propertyContainer
Gets the IContainer that contains the Component.
(Inherited from Component.)
Public propertyDataEncoding
The character-encoding to use for transferring data in ASCII mode.
Public propertyDeleteOnFailure
Controls whether or not a file is deleted when a failure occurs.
Protected propertyDesignMode
Gets a value that indicates whether the Component is currently in design mode.
(Inherited from Component.)
Public propertyDirectoryEmptyMessages
Holds fragments of server messages that indicate a directory is empty.
Protected propertyEvents
Gets the list of event handlers that are attached to this Component.
(Inherited from Component.)
Public propertyEventsEnabled
Determines whether or not events are currently enabled.
Public propertyFileInfoParser
Override the chosen file factory with a user created one - meaning that a specific parser has been selected
Public propertyFileNotFoundMessages
Holds fragments of server messages that indicate a file was not found
Public propertyHomeDirectory
The server-side directory that the client is in immediately after connecting.
Public propertyIsConnected
Indicates whether the FTP client is currently connected with the server.
Public propertyIsTransferring
Indicates whether the FTP client is currently transferring data.
Public propertyLastTransferCancelled
Indicates whether or not the most recent transfer was cancelled.
Public propertyLastValidReply
The latest valid reply from the server.
Public propertyLocalDirectory
The working directory on the local file-system into which files are downloaded.
Public propertyStatic memberLogFile
Name of file to which logs will be written.
Public propertyStatic memberLogLevel
Determines the level of logs written.
Public propertyLogTag
Logging tag
Public propertyStatic memberLogToConsole
Determines whether or not logs will be written to the console.
Public propertyStatic memberLogToTrace
Determines whether or not logs will be written using Trace.
Public propertyName
Name of this component.
Public propertyParentControl
Reference to Windows Forms controls (if available).
Public propertyParsingCulture
The culture for parsing file listings.
Public propertyPassword
Password of account on the server.
Public propertyProtocol
Public propertyPublicIPAddress
IP address of the client as the server sees it.
Public propertyServerAddress
The domain-name or IP address of the FTP server.
Public propertyServerDirectory
The initial/current working directory on the server.
Public propertyServerPort
The port on the server to which to connect the control-channel.
Public propertyShowHiddenFiles
Include hidden files in operations that involve listing of directories, and if supported by the server (FTP and FTPS).
Public propertySite (Overrides ComponentSite.)
Public propertyStrictReturnCodes
Controls whether or not checking of return codes is strict.
Public propertySynchronizePassiveConnections
For cases where the FTP server does not properly manage PASV connections, it may be necessary to synchronize the creation of passive data sockets. It has been reported that some FTP servers (such as those at Akamai) appear to get confused when multiple FTP clients from the same IP address attempt to connect at the same time (the server sends the same port number to multiple clients).
Public propertyTCPBufferSize
TCP read/write buffer size of the underlying sockets (-1 means use defaults). For some transfers setting this value to 0 can improve performance.
Public propertyTimeDifference
[FTP/FTPS Only] Time difference between server and client (relative to client).
Public propertyTimeIncludesSeconds
[FTP/FTPS Only] Indicates whether seconds were included in the most recent directoy listing.
Public propertyTimeout
TCP timeout (in milliseconds) of the underlying sockets (0 means none).
Public propertyTransferBufferSize
The size of the application buffers used in reading and writing data.
Public propertyTransferCompleteMessages
Holds fragments of server messages that indicate a transfer completed.
Public propertyTransferNotifyInterval
The number of bytes transferred between each notification of the BytesTransferred event.
Public propertyTransferNotifyListings
By default the BytesTransferred event is not triggered during directory listings - this property can be used to enable this behaviour.
Public propertyTransferType
The current file transfer type (BINARY or ASCII).
Public propertyUseGuiThreadIfAvailable
Determines whether or not event-handlers will be run on the GUI thread if one is available.
Public propertyUserName
User-name of account on the server.
Public propertyVersion
The version of the assembly.
Public propertyWelcomeMessage
Server's welcome message.
Top
Methods
  NameDescription
Public methodCancelResume
Cancel the resume.
Public methodCancelTransfer
Cancels the current transfer.
Public methodChangeWorkingDirectory
Changes the working directory.
Public methodChangeWorkingDirectoryUp
Changes to the parent of the current working directory on the server.
Protected methodCheckConnection
Checks if the client has connected to the server and throws an exception if it hasn't. This is only intended to be used by subclasses
Protected methodCheckFTPType
Checks the FTP type and throws an exception if it's incorrect.
Public methodClose
Quit the FTP session.
Public methodClose(Boolean)
Close the FTP connection.
Public methodConnect
Connect to the FTP server and (if AutoLogin is set) log into the server.
Public methodCreateDirectory
Create the specified remote directory.
Public methodCreateObjRef
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject.)
Public methodDeleteDirectory
Delete the specified remote directory.
Public methodDeleteFile
Delete the specified remote file.
Public methodDirectoryExists
Tests if the given directory exists.
Public methodDispose
Releases all resources used by the Component.
(Inherited from Component.)
Protected methodDispose(Boolean)
Disconnect from the server (if connected).
(Overrides ComponentDispose(Boolean).)
Public methodDownloadByteArray
Download data from the FTP server and return it as a byte-array.
Public methodDownloadFile(String, String)
Download a file from the FTP server and save it locally.
Public methodDownloadFile(String, String, WriteMode)
Download a file from the FTP server and save it locally.
Public methodDownloadStream
Download a file from the FTP server and write it to the given stream.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodExists
Checks for the existence of a file on the server.
Protected methodFinalize
Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection.
(Inherited from Component.)
Protected methodftpClient_BytesTransferred
Event-handler for BytesTransferred events received from IFileTransferClients.
Protected methodftpClient_CommandSent
Event-handler for [!:IFileTransferClient.CommandSent] events received from IFileTransferClients.
Protected methodftpClient_ReplyReceived
Event-handler for [!:IFileTransferClient.ReplyReceived] events received from IFileTransferClients.
Public methodGetCommandHelp
Get the help text for the specified FTP command.
Public methodGetFeatures
Get the server supplied features.
Public methodGetFileInfos
Returns the working directory's contents as an array of FTPFile objects.
Public methodGetFileInfos(String)
Returns the given directory's contents as an array of FTPFile objects.
Public methodGetFileInfos(String, FTPFileCallback)
Returns the given directory's contents as an array of FTPFile objects.
Public methodGetFiles
Lists current working directory's contents as an array of strings of file-names.
Public methodGetFiles(String)
List the given directory's contents as an array of strings of file-names.
Public methodGetFiles(String, Boolean)
List the given directory's contents as an array of strings of file-names or full file details.
Public methodGetHashCode
Returns hash-code for this connection.
(Overrides ObjectGetHashCode.)
Public methodGetLastWriteTime
Get modification time for a remote file.
Public methodGetLifetimeService
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Protected methodGetService
Returns an object that represents a service provided by the Component or by its Container.
(Inherited from Component.)
Public methodGetSize
Get the size of a remote file.
Public methodGetSystemType
Get the type of the operating system at the server.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetURL
Returns a URL corresponding to the current state of this SecureFTPConnection.
Public methodGetURL(Boolean, Boolean, Boolean)
Returns a URL corresponding to the current state of this SecureFTPConnection. The URL optionally includes the directory, user-name and password.
Public methodInitializeLifetimeService
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Protected methodInvokeDelegate
Invokes the given delegate.
Protected methodInvokeEventHandler(Delegate, Object, EventArgs)
Invokes the given event-handler.
Protected methodInvokeEventHandler(Boolean, Delegate, Object, EventArgs)
Invokes the given event-handler.
Protected methodInvokeEventHandler(Boolean, Boolean, Delegate, Object, EventArgs)
Invokes the given event-handler.
Public methodInvokeFTPCommand
Invokes the given literal FTP command on the server.
Public methodInvokeSiteCommand
Invokes the given site command on the server.
Public methodLinkComponent
Public methodLogin
Log into an account on the FTP server using UserName and Password.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodMemberwiseClone(Boolean)
Creates a shallow copy of the current MarshalByRefObject object.
(Inherited from MarshalByRefObject.)
Protected methodOnBytesTransferred
Called every time a specified number of bytes of data have been transferred.
Protected methodOnChangedLocalDirectory
Called when the local directory has been changed.
Protected methodOnChangedServerDirectory
Called when the server directory has been changed.
Protected methodOnChangingLocalDirectory
Called when the local directory is about to be changed.
Protected methodOnChangingServerDirectory
Called when the server directory is about to be changed.
Protected methodOnClosed Obsolete.
Called when a connection has closed.
Protected methodOnClosed(Exception)
Called when a connection has closed.
Protected methodOnClosing Obsolete.
Called when a connection is about to close.
Protected methodOnClosing(Exception)
Called when a connection is about to close.
Protected methodOnConnected(Boolean) Obsolete.
Called when a connection-attempt has completed.
Protected methodOnConnected(Exception)
Called when a connection is about to close.
Protected methodOnConnecting
Called when a connection-attempt is being made.
Protected methodOnCreatedDirectory
Called when a directory has been created.
Protected methodOnCreatingDirectory
Called when a directory is about to be created.
Protected methodOnDeleted
Called when a file deletion operation has completed (though it may have been cancelled).
Protected methodOnDeletedDirectory
Called when a directory has been deleted.
Protected methodOnDeleting
Called when a file is about to be deleted.
Protected methodOnDeletingDirectory
Called when a directory is about to be deleted.
Protected methodOnDirectoryListed
Called when a directory listing has been retrieved.
Protected methodOnDirectoryListing
Called when a directory listing is about to be retrieved.
Protected methodOnDownloaded(Byte, String, Int64, Exception, Int64, DateTime)
Called when a file downloading operation has completed (though it may have been cancelled).
Protected methodOnDownloaded(Stream, String, Int64, Exception, Int64, DateTime)
Called when a file downloading operation has completed (though it may have been cancelled).
Protected methodOnDownloaded(String, String, Int64, Boolean, Exception, Int64, DateTime)
Called when a file downloading operation has completed (though it may have been cancelled).
Protected methodOnDownloading(String, Int64, DateTime)
Called when a file is about to be downloaded.
Protected methodOnDownloading(Stream, String, Int64, Int64, DateTime)
Called when a file is about to be downloaded.
Protected methodOnDownloading(String, String, Boolean, Int64, DateTime)
Called when a file is about to be downloaded.
Protected methodOnLoggedIn
Called when the client has logged in.
Protected methodOnLoggingIn
Called when the client is about to log in.
Protected methodOnPropertyChanged
Called when a property has been changed.
Protected methodOnRenamed
Called when a file has been renamed.
Protected methodOnRenaming
Called when a file is about to be renamed.
Protected methodOnUploaded(Byte, String, Int64, WriteMode, Exception)
Called when a file uploading operation has completed (though it may have been cancelled).
Protected methodOnUploaded(Byte, String, Int64, Boolean, Exception) Obsolete.
Protected methodOnUploaded(String, String, Int64, WriteMode, Exception)
Called when a file uploading operation has completed (though it may have been cancelled).
Protected methodOnUploaded(Stream, Int64, String, WriteMode, Exception, Int64)
Called when a file uploading operation has completed (though it may have been cancelled).
Protected methodOnUploaded(Stream, Int64, String, Boolean, Exception, Int64) Obsolete.
Protected methodOnUploaded(String, String, Int64, Boolean, Boolean, Exception) Obsolete.
Protected methodOnUploading(Byte, String, WriteMode)
Called when a byte-array is about to be uploaded.
Protected methodOnUploading(Byte, String, Boolean) Obsolete.
Protected methodOnUploading(String, String, WriteMode)
Called when a file is about to be uploaded.
Protected methodOnUploading(Stream, String, WriteMode, Int64)
Called when a stream is about to be uploaded.
Protected methodOnUploading(Stream, String, Boolean, Int64) Obsolete.
Protected methodPerformAutoLogin
Attempt to log into the server if AutoLogin is on.
Public methodPostLogin
Called after the user has been successfully logged in.
Protected methodRaiseBytesTransferred
Raise the BytesTransferred event.
Protected methodRaiseClosed
Raise the Closed event.
Protected methodRaiseClosing
Raise the Closing event.
Protected methodRaiseCommandSent
Raise the CommandSent event.
Protected methodRaiseConnected
Raise the Connected event.
Protected methodRaiseConnecting
Raise the Connecting event.
Protected methodRaiseCreatedDirectory
Raise the CreatedDirectory event.
Protected methodRaiseCreatingDirectory
Raise the CreatingDirectory event.
Protected methodRaiseDeleted
Raise the Deleted event.
Protected methodRaiseDeletedDirectory
Raise the DeletedDirectory event.
Protected methodRaiseDeleting
Raise the Deleting event.
Protected methodRaiseDeletingDirectory
Raise the DeletingDirectory event.
Protected methodRaiseDirectoryChanged
Raise the DirectoryChanged event.
Protected methodRaiseDirectoryChanging
Raise the DirectoryChanging event.
Protected methodRaiseDirectoryListed
Raise the DirectoryListed event.
Protected methodRaiseDirectoryListing
Raise the DirectoryListing event.
Protected methodRaiseDownloaded
Raise the Downloaded event.
Protected methodRaiseDownloading
Raise the Downloading event.
Protected methodRaiseLocalDirectoryChanged
Raise the LocalDirectoryChanged event.
Protected methodRaiseLocalDirectoryChanging
Raise the LocalDirectoryChanging event.
Protected methodRaiseLoggedIn
Raise the LoggedIn event.
Protected methodRaiseLoggingIn
Raise the LoggingIn event.
Protected methodRaisePropertyChanged
Raise the PropertyChanged event.
Protected methodRaiseRenamedFile
Raise the RenamedFile event.
Protected methodRaiseRenamingFile
Raise the RenamingFile event.
Protected methodRaiseReplyReceived
Raise the ReplyReceived event.
Protected methodRaiseServerDirectoryChanged
Raise the ServerDirectoryChanged event.
Protected methodRaiseServerDirectoryChanging
Raise the ServerDirectoryChanging event.
Protected methodRaiseUploaded
Raise the Uploaded event.
Protected methodRaiseUploading
Raise the Uploading event.
Protected methodRelativePathToAbsolute
Combines a relative path with an absolute path.
Public methodRenameFile
Rename a file or directory.
Public methodResumeNextDownload
Make the next download resume at a specific point.
Public methodResumeNextTransfer
Make the next file transfer (upload or download) resume.
Public methodResumeTransfer Obsolete.
Make the next file transfer (upload or download) resume.
Public methodSendAccountInfo
Supply account info to the FTP server.
Public methodSendPassword
Supply the password for the previously supplied user-name to log into the FTP server. Must be preceeded by the SendUserName(String) method
Public methodSendUserName
Supply the user-name to log into an account on the FTP server. Must be followed by the SendPassword(String) method.
Public methodSetLastWriteTime
Set modification time for a remote file.
Public methodToString
Returns a string representation of the connection.
(Overrides ComponentToString.)
Public methodUploadByteArray(Byte, String)
Upload an array of bytes to the FTP server in the current working directory.
Public methodUploadByteArray(Byte, String, WriteMode)
Upload data to the FTP server in the current working directory. Allows appending if current file exists.
Public methodUploadByteArray(Byte, String, Boolean)
Upload data to the FTP server in the current working directory. Allows appending if current file exists.
Public methodUploadFile(String, String)
Upload a local file to the FTP server in the current working directory.
Public methodUploadFile(String, String, WriteMode)
Upload a local file to the FTP server in the current working directory. Allows appending if current file exists.
Public methodUploadFile(String, String, Boolean) Obsolete.
Upload a local file to the FTP server in the current working directory. Allows appending if current file exists.
Public methodUploadStream(Stream, String)
Upload a stream of data to the FTP server in the current working directory.
Public methodUploadStream(Stream, String, WriteMode)
Upload a stream of data to the FTP server in the current working directory. Allows appending if current file exists.
Public methodUploadStream(Stream, String, Boolean)
Upload a stream of data to the FTP server in the current working directory. Allows appending if current file exists.
Top
Events
  NameDescription
Public eventBytesTransferred
Occurs every time a specified number of bytes of data have been transferred.
Public eventClosed
Occurs when the component has closed its connection to the server.
Public eventClosing
Occurs when the component is about to close its connection to the server.
Public eventCommandSent
Occurs when a command is sent to the server.
Public eventConnected
Occurs when the component has connected to the server.
Public eventConnecting
Occurs when the component is connecting to the server.
Public eventCreatedDirectory
Occurs when a local directory has been created on the server.
Public eventCreatingDirectory
Occurs when a directory is about to be created on the server.
Public eventDeleted
Occurs when a file has been deleted from the server.
Public eventDeletedDirectory
Occurs when a local directory has been deleted on the server.
Public eventDeleting
Occurs when a file is about to be deleted from the server.
Public eventDeletingDirectory
Occurs when a directory is about to be deleted on the server.
Public eventDirectoryListed
Occurs when a directory listing operations is completed.
Public eventDirectoryListing
Occurs when a directory listing operations is commenced.
Public eventDisposed
Occurs when the component is disposed by a call to the Dispose method.
(Inherited from Component.)
Public eventDownloaded
Occurs when a file has been downloaded from the server.
Public eventDownloading
Occurs when a file is about to be downloaded from the server.
Public eventLocalDirectoryChanged
Occurs when the local directory has been changed.
Public eventLocalDirectoryChanging
Occurs when the local directory is about to be changed.
Public eventLoggedIn
Occurs when the component has logged in.
Public eventLoggingIn
Occurs when the component is about to log in.
Public eventPropertyChanged
Occurs when a property is changed.
Public eventRenamedFile
Occurs when a remote file has been renamed.
Public eventRenamingFile
Occurs when a remote file is about to be renamed.
Public eventReplyReceived
Occurs when a reply is received from the server.
Public eventServerDirectoryChanged
Occurs when the server directory has been changed.
Public eventServerDirectoryChanging
Occurs when the server directory is about to be changed.
Public eventUploaded
Occurs when a file has been uploaded to the server.
Public eventUploading
Occurs when a file is about to be uploaded to the server.
Top
Fields
  NameDescription
Protected fieldaccountInfoStr
Account information string, for use in FTP/FTPS with the ACCT command.
Protected fieldareEventsEnabled
Determines if events will be fired.
Protected fieldclientLock
Used for locking connection.
Protected fieldStatic memberDEFAULT_WORKING_DIRECTORY
Default initial working directory.
Protected fieldfileTransferType
Record of the transfer type - make the default ASCII.
Protected fieldftpClient
Instance of FTPClient.
Protected fieldftpType
Protocol used.
Protected fieldguiControl
Reference to the main window.
Protected fieldhaveQueriedForControl
Flag used to remember whether or not we've tried to find the main window yet.
Protected fieldhomeDir
User's home directory on the server.
Protected fieldisTransferringData
Determines if events will be fired.
Protected fieldlastTransferCancel
Flag indicating that the most recent transfer-operation was cancelled
Protected fieldlocalDir
Current local working directory.
Protected fieldloginPassword
Password to log in with.
Protected fieldloginUserName
User-name to log in with.
Protected fieldlogTag
Logging tag
Protected fieldremoteDir
Current remote working directory.
Protected fielduseAutoFeatures
Determines if the components will automatically send the FEAT command after logging in.
Protected fielduseAutoLogin
Determines if the components will automatically log in upon connection.
Protected fielduseGuiThread
Flag indicating whether or not event-handlers will run on the GUI thread if one is available.
Top
Remarks

FTPConnection provides FTP client functionality. It is a .NET Component which may be used in visual designers, or it may be used as a conventional class.

Constructing and connecting: The constructor for FTPConnection takes no arguments. Before connecting to a server, the FTPConnection must be configured with the ServerAddress, UserName and Password. After this has been done, the Connect method should be called, which will connect and log onto the server.

FTPConnection ftp = new FTPConnection();
ftp.ServerAddress = "myservername";
ftp.UserName = "myusername";
ftp.Password = "mypassword";
ftp.Connect();
ftp.Close();
The Close method should be called when the required FTP operations have been completed so that the connection to the server is released.

Directory listings: Directory listings may be obtained in two basic forms: (1) The method GetFiles(String) returns strings containing file-names. (2) The method GetFileInfos(String) returns FTPFile objects which contain information about the file including name, size, and date.

Downloading and uploading files: There are many different methods for downloading files from the server and uploading them to the server. Data may be copied from or to:

  1. Files (DownloadFile(String, String) and UploadFile(String, String)
  2. Streams (DownloadStream(Stream, String) and UploadStream(Stream, String))
  3. Byte-arrays (DownloadByteArray(String) and UploadByteArray(Byte, String)
Methods for downloading and uploading multiple files and directories are available in ExFTPConnection and SecureFTPConnection, which are included in EDT's commercial .NET FTP products.

Other file operations: Other operations that may be performed on files are:

Directories: The server maintains a "working directory" for each session. The path of the current working directory may be set and retrieved using the WorkingDirectory property. Changing directory to a subdirectory of the current working directory may be done by setting the same property, or by using the ChangeWorkingDirectory(String) method. Changing up to a parent directory is done using the ChangeWorkingDirectoryUp method. Empty directories may be removed using DeleteDirectory(String). If a non-empty directory is to be deleted then all the files and subdirectories in it must be deleted first. ExFTPConnection and SecureFTPConnection have methods for achieving this in a single method-call.

Events:FTPConnection fires events before and after most FTP operations. For example, before a file is downloaded the Downloading event is fired, while it's downloading the BytesTransferred event is fired each time TransferNotifyInterval bytes have been transferred, and after it's been downloaded the Downloaded event is fired. Operations that have corresponding events are:

FTP OperationEvents
Connecting and logging inConnecting, LoggingIn, LoggedIn, and Connected
ClosingClosing and Closed
Downloading dataDownloading, BytesTransferred and Downloaded
Uploading dataUploading, BytesTransferred and Uploaded
Changing directoriesDirectoryChanging and DirectoryChanged
Deleting files/directoriesDeleting and Deleted
Sending FTP commandsCommandSent and ReplyReceived

Logging: It is often very helpful to look at the detailed logging output if any problems are experienced communicating with FTP servers. All commands sent to the FTP server and subsequent replies are logged, and can be made available on the console or directed to a log file. Much other useful information is also logged.

Operations are logged at different levels, ranging from no logging (Off) to most verbose (All). Intermediate levels are Fatal, Error, Warning and Information.For example, if the overall level is set to Information, then Fatal, Error, Warning and Information log statements will be outputted, but Debug statements will not be logged.

The overall level can be set via the LogLevel property:

ftpConnection.LogLevel = LogLevel.Information;
The destination for logging can be set via several properties, described below:
PropertyDescription
LogToConsoleIf set to true, logging is directed to the console.
LogToTraceIf set to true, logging is directed to .NET's Trace facility.
LogFileIf to a valid filename, logging is directed to the file.

Overview of the FTP protocol: FTP is defined in the Request For Comments 959 document (RFC 959), which can be obtained from the Internet Engineering Task Force.

FTP requires a client program (FTP client) and a server program (FTP server). The FTP client can fetch files and file details from the server, and also upload files to the server. The server is generally loginPassword protected.

FTP commands are initiated by the FTP client, which opens a TCP connection called the control connection to the server. This control connection is used for the entire duration of a session between the FTP client and server. A session typically begins when the FTP client logs in, and ends when the quit command is sent to the server. The control connection is used exclusively for sending FTP commands and reading server replies - it is never used to transfer files.

Transient TCP connections called data connections are set up whenever data (normally a file's contents) is to be transferred. For example, the FTP client issues a command to retrieve a file from the server via the control channel. A data connection is then established, and the file's contents transferred to the FTP client across it. Once the transfer is complete, the data connection is closed. Meanwhile, the control connection is maintained.

Compliance: FTPClient implements FTP as defined by RFC959. It attempts to match the standard as closely as possible, but due to variation in the level of compliance of the numerous FTP servers available, it sometime allows servers some tolerance. If the property StrictReturnCodes is set to false then FTPClient is more tolerant of non-compliant servers.

See Also