FTPConnection Class |
Namespace: EnterpriseDT.Net.Ftp
The FTPConnection type exposes the following members.
Name | Description | |
---|---|---|
![]() | FTPConnection |
Default constructor for FTPConnection.
|
![]() | FTPConnection(FTPClient) |
Create an FTPConnection using the given FTP client.
|
![]() | FTPConnection(IContainer) |
Creates an instance of FTPConnection within the given container.
|
Name | Description | |
---|---|---|
![]() | AccountInfo | Account information string. |
![]() | ActiveClient |
Reference to the currently active IFileTransferClient.
|
![]() | ActivePortRange |
Specifies the range of ports to be used for data-channels in active mode.
|
![]() | AutoFeatures | Determines if the component will automatically send the FEAT command. |
![]() | AutoLogin | Determines if the component will automatically log in upon connection. |
![]() | AutoPassiveIPSubstitution |
Use AutoPassiveIPSubstitution to ensure that
data-socket connections are made to the same IP address
that the control socket is connected to.
|
![]() | BuildTimestamp | The assembly's build timestamp. |
![]() | CanRaiseEvents | Gets a value indicating whether the component can raise an event. (Inherited from Component.) |
![]() | CloseStreamsAfterTransfer |
Determines if transfer-methods taking Streams as arguments should
close the stream once the transfer is completed.
|
![]() | CommandEncoding |
The character-encoding to use for FTP control commands and when dealing with file- and directory-paths.
|
![]() | ConnectMode |
The connection-mode (passive or active) of data-channels.
|
![]() | Container | Gets the IContainer that contains the Component. (Inherited from Component.) |
![]() | DataEncoding |
The character-encoding to use for transferring data in ASCII mode.
|
![]() | DeleteOnFailure |
Controls whether or not a file is deleted when a failure occurs.
|
![]() | DesignMode | Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.) |
![]() | DirectoryEmptyMessages |
Holds fragments of server messages that indicate a directory
is empty.
|
![]() | Events | Gets the list of event handlers that are attached to this Component. (Inherited from Component.) |
![]() | EventsEnabled | Determines whether or not events are currently enabled. |
![]() | FileInfoParser |
Override the chosen file factory with a user created one - meaning
that a specific parser has been selected
|
![]() | FileNotFoundMessages |
Holds fragments of server messages that indicate a file was not found
|
![]() | HomeDirectory |
The server-side directory that the client is in immediately after connecting.
|
![]() | IsConnected |
Indicates whether the FTP client is currently connected with the server.
|
![]() | IsTransferring |
Indicates whether the FTP client is currently transferring data.
|
![]() | LastTransferCancelled |
Indicates whether or not the most recent transfer was cancelled.
|
![]() | LastValidReply | The latest valid reply from the server. |
![]() | LocalDirectory |
The working directory on the local file-system into which files are downloaded.
|
![]() ![]() | LogFile |
Name of file to which logs will be written.
|
![]() ![]() | LogLevel |
Determines the level of logs written.
|
![]() | LogTag |
Logging tag
|
![]() ![]() | LogToConsole |
Determines whether or not logs will be written to the console.
|
![]() ![]() | LogToTrace |
Determines whether or not logs will be written using Trace.
|
![]() | Name |
Name of this component.
|
![]() | ParentControl |
Reference to Windows Forms controls (if available).
|
![]() | ParsingCulture | The culture for parsing file listings. |
![]() | Password | Password of account on the server. |
![]() | Protocol | |
![]() | PublicIPAddress |
IP address of the client as the server sees it.
|
![]() | ServerAddress |
The domain-name or IP address of the FTP server.
|
![]() | ServerDirectory |
The initial/current working directory on the server.
|
![]() | ServerPort |
The port on the server to which to connect the control-channel.
|
![]() | ShowHiddenFiles |
Include hidden files in operations that involve listing of directories,
and if supported by the server (FTP and FTPS).
|
![]() | Site | (Overrides ComponentSite.) |
![]() | StrictReturnCodes | Controls whether or not checking of return codes is strict. |
![]() | SynchronizePassiveConnections |
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).
|
![]() | TCPBufferSize |
TCP read/write buffer size of the underlying sockets (-1 means use defaults). For some
transfers setting this value to 0 can improve performance.
|
![]() | TimeDifference |
[FTP/FTPS Only] Time difference between server and client (relative to client).
|
![]() | TimeIncludesSeconds |
[FTP/FTPS Only] Indicates whether seconds were included in the most recent directoy listing.
|
![]() | Timeout |
TCP timeout (in milliseconds) of the underlying sockets (0 means none).
|
![]() | TransferBufferSize |
The size of the application buffers used in reading and writing data.
|
![]() | TransferCompleteMessages |
Holds fragments of server messages that indicate a transfer completed.
|
![]() | TransferNotifyInterval |
The number of bytes transferred between each notification of the
BytesTransferred event.
|
![]() | TransferNotifyListings |
By default the BytesTransferred event is not triggered
during directory listings - this property can be used to enable this behaviour.
|
![]() | TransferType | The current file transfer type (BINARY or ASCII). |
![]() | UseGuiThreadIfAvailable | Determines whether or not event-handlers will be run on the GUI thread if one is available. |
![]() | UserName | User-name of account on the server. |
![]() | Version | The version of the assembly. |
![]() | WelcomeMessage |
Server's welcome message.
|
Name | Description | |
---|---|---|
![]() | CancelResume | Cancel the resume. |
![]() | CancelTransfer | Cancels the current transfer. |
![]() | ChangeWorkingDirectory |
Changes the working directory.
|
![]() | ChangeWorkingDirectoryUp |
Changes to the parent of the current working directory on the server.
|
![]() | CheckConnection |
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
|
![]() | CheckFTPType |
Checks the FTP type and throws an exception if it's incorrect.
|
![]() | Close | Quit the FTP session. |
![]() | Close(Boolean) | Close the FTP connection. |
![]() | Connect | Connect to the FTP server and (if AutoLogin is set) log into the server. |
![]() | CreateDirectory | Create the specified remote directory. |
![]() | CreateObjRef | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.) |
![]() | DeleteDirectory | Delete the specified remote directory. |
![]() | DeleteFile | Delete the specified remote file. |
![]() | DirectoryExists |
Tests if the given directory exists.
|
![]() | Dispose | Releases all resources used by the Component. (Inherited from Component.) |
![]() | Dispose(Boolean) | Disconnect from the server (if connected). (Overrides ComponentDispose(Boolean).) |
![]() | DownloadByteArray | Download data from the FTP server and return it as a byte-array. |
![]() | DownloadFile(String, String) | Download a file from the FTP server and save it locally. |
![]() | DownloadFile(String, String, WriteMode) | Download a file from the FTP server and save it locally. |
![]() | DownloadStream | Download a file from the FTP server and write it to the given stream. |
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | Exists |
Checks for the existence of a file on the server.
|
![]() | Finalize | Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.) |
![]() | ftpClient_BytesTransferred |
Event-handler for BytesTransferred events received from IFileTransferClients.
|
![]() | ftpClient_CommandSent |
Event-handler for [!:IFileTransferClient.CommandSent] events received from IFileTransferClients.
|
![]() | ftpClient_ReplyReceived |
Event-handler for [!:IFileTransferClient.ReplyReceived] events received from IFileTransferClients.
|
![]() | GetCommandHelp | Get the help text for the specified FTP command. |
![]() | GetFeatures | Get the server supplied features. |
![]() | GetFileInfos |
Returns the working directory's contents as an array of FTPFile objects.
|
![]() | GetFileInfos(String) |
Returns the given directory's contents as an array of FTPFile objects.
|
![]() | GetFileInfos(String, FTPFileCallback) |
Returns the given directory's contents as an array of FTPFile objects.
|
![]() | GetFiles |
Lists current working directory's contents as an array of strings of file-names.
|
![]() | GetFiles(String) |
List the given directory's contents as an array of strings of file-names.
|
![]() | GetFiles(String, Boolean) |
List the given directory's contents as an array of strings of file-names or
full file details.
|
![]() | GetHashCode |
Returns hash-code for this connection.
(Overrides ObjectGetHashCode.) |
![]() | GetLastWriteTime | Get modification time for a remote file. |
![]() | GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | GetService | (Inherited from Component.) |
![]() | GetSize |
Get the size of a remote file.
|
![]() | GetSystemType | Get the type of the operating system at the server. |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | GetURL |
Returns a URL corresponding to the current state of this SecureFTPConnection.
|
![]() | GetURL(Boolean, Boolean, Boolean) |
Returns a URL corresponding to the current state of this SecureFTPConnection.
The URL optionally includes the directory, user-name and password.
|
![]() | InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | InvokeDelegate |
Invokes the given delegate.
|
![]() | InvokeEventHandler(Delegate, Object, EventArgs) |
Invokes the given event-handler.
|
![]() | InvokeEventHandler(Boolean, Delegate, Object, EventArgs) |
Invokes the given event-handler.
|
![]() | InvokeEventHandler(Boolean, Boolean, Delegate, Object, EventArgs) |
Invokes the given event-handler.
|
![]() | InvokeFTPCommand |
Invokes the given literal FTP command on the server.
|
![]() | InvokeSiteCommand |
Invokes the given site command on the server.
|
![]() | LinkComponent | |
![]() | Login | |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.) |
![]() | OnBytesTransferred |
Called every time a specified number of bytes of data have been transferred.
|
![]() | OnChangedLocalDirectory |
Called when the local directory has been changed.
|
![]() | OnChangedServerDirectory |
Called when the server directory has been changed.
|
![]() | OnChangingLocalDirectory |
Called when the local directory is about to be changed.
|
![]() | OnChangingServerDirectory |
Called when the server directory is about to be changed.
|
![]() | OnClosed | Obsolete.
Called when a connection has closed.
|
![]() | OnClosed(Exception) |
Called when a connection has closed.
|
![]() | OnClosing | Obsolete.
Called when a connection is about to close.
|
![]() | OnClosing(Exception) |
Called when a connection is about to close.
|
![]() | OnConnected(Boolean) | Obsolete.
Called when a connection-attempt has completed.
|
![]() | OnConnected(Exception) |
Called when a connection is about to close.
|
![]() | OnConnecting |
Called when a connection-attempt is being made.
|
![]() | OnCreatedDirectory |
Called when a directory has been created.
|
![]() | OnCreatingDirectory |
Called when a directory is about to be created.
|
![]() | OnDeleted |
Called when a file deletion operation has completed (though it may have been cancelled).
|
![]() | OnDeletedDirectory |
Called when a directory has been deleted.
|
![]() | OnDeleting |
Called when a file is about to be deleted.
|
![]() | OnDeletingDirectory |
Called when a directory is about to be deleted.
|
![]() | OnDirectoryListed |
Called when a directory listing has been retrieved.
|
![]() | OnDirectoryListing |
Called when a directory listing is about to be retrieved.
|
![]() | OnDownloaded(Byte, String, Int64, Exception, Int64, DateTime) |
Called when a file downloading operation has completed (though it may have been cancelled).
|
![]() | OnDownloaded(Stream, String, Int64, Exception, Int64, DateTime) |
Called when a file downloading operation has completed (though it may have been cancelled).
|
![]() | OnDownloaded(String, String, Int64, Boolean, Exception, Int64, DateTime) |
Called when a file downloading operation has completed (though it may have been cancelled).
|
![]() | OnDownloading(String, Int64, DateTime) |
Called when a file is about to be downloaded.
|
![]() | OnDownloading(Stream, String, Int64, Int64, DateTime) |
Called when a file is about to be downloaded.
|
![]() | OnDownloading(String, String, Boolean, Int64, DateTime) |
Called when a file is about to be downloaded.
|
![]() | OnLoggedIn |
Called when the client has logged in.
|
![]() | OnLoggingIn |
Called when the client is about to log in.
|
![]() | OnPropertyChanged |
Called when a property has been changed.
|
![]() | OnRenamed |
Called when a file has been renamed.
|
![]() | OnRenaming |
Called when a file is about to be renamed.
|
![]() | OnUploaded(Byte, String, Int64, WriteMode, Exception) |
Called when a file uploading operation has completed (though it may have been cancelled).
|
![]() | OnUploaded(Byte, String, Int64, Boolean, Exception) | Obsolete. |
![]() | OnUploaded(String, String, Int64, WriteMode, Exception) |
Called when a file uploading operation has completed (though it may have been cancelled).
|
![]() | OnUploaded(Stream, Int64, String, WriteMode, Exception, Int64) |
Called when a file uploading operation has completed (though it may have been cancelled).
|
![]() | OnUploaded(Stream, Int64, String, Boolean, Exception, Int64) | Obsolete. |
![]() | OnUploaded(String, String, Int64, Boolean, Boolean, Exception) | Obsolete. |
![]() | OnUploading(Byte, String, WriteMode) |
Called when a byte-array is about to be uploaded.
|
![]() | OnUploading(Byte, String, Boolean) | Obsolete. |
![]() | OnUploading(String, String, WriteMode) |
Called when a file is about to be uploaded.
|
![]() | OnUploading(Stream, String, WriteMode, Int64) |
Called when a stream is about to be uploaded.
|
![]() | OnUploading(Stream, String, Boolean, Int64) | Obsolete. |
![]() | PerformAutoLogin | Attempt to log into the server if AutoLogin is on. |
![]() | PostLogin |
Called after the user has been successfully logged in.
|
![]() | RaiseBytesTransferred | Raise the BytesTransferred event. |
![]() | RaiseClosed | Raise the Closed event. |
![]() | RaiseClosing | Raise the Closing event. |
![]() | RaiseCommandSent | Raise the CommandSent event. |
![]() | RaiseConnected | Raise the Connected event. |
![]() | RaiseConnecting | Raise the Connecting event. |
![]() | RaiseCreatedDirectory | Raise the CreatedDirectory event. |
![]() | RaiseCreatingDirectory | Raise the CreatingDirectory event. |
![]() | RaiseDeleted | Raise the Deleted event. |
![]() | RaiseDeletedDirectory | Raise the DeletedDirectory event. |
![]() | RaiseDeleting | Raise the Deleting event. |
![]() | RaiseDeletingDirectory | Raise the DeletingDirectory event. |
![]() | RaiseDirectoryChanged | Raise the DirectoryChanged event. |
![]() | RaiseDirectoryChanging | Raise the DirectoryChanging event. |
![]() | RaiseDirectoryListed | Raise the DirectoryListed event. |
![]() | RaiseDirectoryListing | Raise the DirectoryListing event. |
![]() | RaiseDownloaded | Raise the Downloaded event. |
![]() | RaiseDownloading | Raise the Downloading event. |
![]() | RaiseLocalDirectoryChanged | Raise the LocalDirectoryChanged event. |
![]() | RaiseLocalDirectoryChanging | Raise the LocalDirectoryChanging event. |
![]() | RaiseLoggedIn | Raise the LoggedIn event. |
![]() | RaiseLoggingIn | Raise the LoggingIn event. |
![]() | RaisePropertyChanged | Raise the PropertyChanged event. |
![]() | RaiseRenamedFile | Raise the RenamedFile event. |
![]() | RaiseRenamingFile | Raise the RenamingFile event. |
![]() | RaiseReplyReceived | Raise the ReplyReceived event. |
![]() | RaiseServerDirectoryChanged | Raise the ServerDirectoryChanged event. |
![]() | RaiseServerDirectoryChanging | Raise the ServerDirectoryChanging event. |
![]() | RaiseUploaded | Raise the Uploaded event. |
![]() | RaiseUploading | Raise the Uploading event. |
![]() | RelativePathToAbsolute |
Combines a relative path with an absolute path.
|
![]() | RenameFile | Rename a file or directory. |
![]() | ResumeNextDownload | Make the next download resume at a specific point. |
![]() | ResumeNextTransfer | Make the next file transfer (upload or download) resume. |
![]() | ResumeTransfer | Obsolete. Make the next file transfer (upload or download) resume. |
![]() | SendAccountInfo |
Supply account info to the FTP server.
|
![]() | SendPassword |
Supply the password for the previously supplied
user-name to log into the FTP server. Must be
preceeded by the SendUserName(String) method
|
![]() | SendUserName |
Supply the user-name to log into an account on the FTP server.
Must be followed by the SendPassword(String) method.
|
![]() | SetLastWriteTime | Set modification time for a remote file. |
![]() | ToString |
Returns a string representation of the connection.
(Overrides ComponentToString.) |
![]() | UploadByteArray(Byte, String) |
Upload an array of bytes to the FTP server in the current working directory.
|
![]() | UploadByteArray(Byte, String, WriteMode) |
Upload data to the FTP server in the current working directory. Allows
appending if current file exists.
|
![]() | UploadByteArray(Byte, String, Boolean) |
Upload data to the FTP server in the current working directory. Allows
appending if current file exists.
|
![]() | UploadFile(String, String) |
Upload a local file to the FTP server in the current working directory.
|
![]() | UploadFile(String, String, WriteMode) |
Upload a local file to the FTP server in the current working directory. Allows appending
if current file exists.
|
![]() | UploadFile(String, String, Boolean) | Obsolete.
Upload a local file to the FTP server in the current working directory. Allows appending
if current file exists.
|
![]() | UploadStream(Stream, String) |
Upload a stream of data to the FTP server in the current working directory.
|
![]() | UploadStream(Stream, String, WriteMode) |
Upload a stream of data to the FTP server in the current working directory. Allows appending
if current file exists.
|
![]() | UploadStream(Stream, String, Boolean) |
Upload a stream of data to the FTP server in the current working directory. Allows appending
if current file exists.
|
Name | Description | |
---|---|---|
![]() | BytesTransferred | Occurs every time a specified number of bytes of data have been transferred. |
![]() | Closed | Occurs when the component has closed its connection to the server. |
![]() | Closing | Occurs when the component is about to close its connection to the server. |
![]() | CommandSent | Occurs when a command is sent to the server. |
![]() | Connected | Occurs when the component has connected to the server. |
![]() | Connecting | Occurs when the component is connecting to the server. |
![]() | CreatedDirectory | Occurs when a local directory has been created on the server. |
![]() | CreatingDirectory | Occurs when a directory is about to be created on the server. |
![]() | Deleted | Occurs when a file has been deleted from the server. |
![]() | DeletedDirectory | Occurs when a local directory has been deleted on the server. |
![]() | Deleting | Occurs when a file is about to be deleted from the server. |
![]() | DeletingDirectory | Occurs when a directory is about to be deleted on the server. |
![]() | DirectoryListed | Occurs when a directory listing operations is completed. |
![]() | DirectoryListing | Occurs when a directory listing operations is commenced. |
![]() | Disposed | Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.) |
![]() | Downloaded | Occurs when a file has been downloaded from the server. |
![]() | Downloading | Occurs when a file is about to be downloaded from the server. |
![]() | LocalDirectoryChanged | Occurs when the local directory has been changed. |
![]() | LocalDirectoryChanging | Occurs when the local directory is about to be changed. |
![]() | LoggedIn | Occurs when the component has logged in. |
![]() | LoggingIn | Occurs when the component is about to log in. |
![]() | PropertyChanged | Occurs when a property is changed. |
![]() | RenamedFile | Occurs when a remote file has been renamed. |
![]() | RenamingFile | Occurs when a remote file is about to be renamed. |
![]() | ReplyReceived | Occurs when a reply is received from the server. |
![]() | ServerDirectoryChanged | Occurs when the server directory has been changed. |
![]() | ServerDirectoryChanging | Occurs when the server directory is about to be changed. |
![]() | Uploaded | Occurs when a file has been uploaded to the server. |
![]() | Uploading | Occurs when a file is about to be uploaded to the server. |
Name | Description | |
---|---|---|
![]() | accountInfoStr | Account information string, for use in FTP/FTPS with the ACCT command. |
![]() | areEventsEnabled | Determines if events will be fired. |
![]() | clientLock |
Used for locking connection.
|
![]() ![]() | DEFAULT_WORKING_DIRECTORY |
Default initial working directory.
|
![]() | fileTransferType | Record of the transfer type - make the default ASCII. |
![]() | ftpClient | Instance of FTPClient. |
![]() | ftpType | Protocol used. |
![]() | guiControl | Reference to the main window. |
![]() | haveQueriedForControl | Flag used to remember whether or not we've tried to find the main window yet. |
![]() | homeDir |
User's home directory on the server.
|
![]() | isTransferringData | Determines if events will be fired. |
![]() | lastTransferCancel |
Flag indicating that the most recent transfer-operation was cancelled
|
![]() | localDir |
Current local working directory.
|
![]() | loginPassword | Password to log in with. |
![]() | loginUserName | User-name to log in with. |
![]() | logTag | Logging tag |
![]() | remoteDir |
Current remote working directory.
|
![]() | useAutoFeatures | Determines if the components will automatically send the FEAT command after logging in. |
![]() | useAutoLogin | Determines if the components will automatically log in upon connection. |
![]() | useGuiThread |
Flag indicating whether or not event-handlers will run on the GUI thread if one is
available.
|
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();
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:
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 Operation | Events |
---|---|
Connecting and logging in | Connecting, LoggingIn, LoggedIn, and Connected |
Closing | Closing and Closed |
Downloading data | Downloading, BytesTransferred and Downloaded |
Uploading data | Uploading, BytesTransferred and Uploaded |
Changing directories | DirectoryChanging and DirectoryChanged |
Deleting files/directories | Deleting and Deleted |
Sending FTP commands | CommandSent 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;
Property | Description |
---|---|
LogToConsole | If set to true, logging is directed to the console. |
LogToTrace | If set to true, logging is directed to .NET's Trace facility. |
LogFile | If 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.