FTPServer Component
Properties Methods Events Config Settings Errors
The FTPServer Component is used to create an FTP server.
Syntax
nsoftware.IPWorksCData.FTPServer
Remarks
The FTPServer Component provides a simple way to create an FTP server. Any FTP client will be able to connect and transfer files to and from the server.
The FTP Component supports both plaintext and Secure Sockets Layer/Transport Layer Security (SSL/TLS) connections. When connecting over Secure Sockets Layer/Transport Layer Security (SSL/TLS) the SSLServerAuthentication event allows you to check the server identity and other security attributes. The SSLStatus event provides information about the SSL handshake. Additional SSL-related settings are also supported through the Config method.
The FTP Component implements a standard FTP server as specified in RFC 959 and RFC 1579 with the added option of SSL security (RFC 2228) in both the protocol and data channels.
Required Properties
The first step in using the component is specifying the LocalPort and calling AddUser to add credentials that clients can use to log into the server. A DefaultRootDir also may be set in the event that not all Users have their own home directories. To use the component with SSL, use SSLEnabled and SSLCert. Finally, set Listening to True. Clients will now be able to connect and browse the directory specified with without further setup.
The PITrail event traces the interaction between the client and the server (the FTP Protocol Interface connection).
Handling Events
Event handlers are the primary method of customizing the component's functionality. When a client attempts to connect, open a file, or authenticate to the server, the corresponding FTPServer event will fire to allow for custom handling of the client's request.
This functionality is especially useful for virtual directory functionality: the client may browse to a directory that does not physically exist in the location requested by the client. The server may use event handling to process directory listing, file and directory manipulation, and transfers for such "virtual" files and directory. By sending the applicable responses for such requests back to the client, it appears to the client that the virtual files and directories exist normally, when in reality, they may exist in another location or not at all.
The following events are fired both before and after the requested operation is executed:
- DirChange
- DirCreate
- DirList
- DirRemove
- FileDelete
- FileDownload
- FileGetSize
- FileGetModifiedTime
- FileRename
- FileUpload
Each of these events has a BeforeExec event parameter that is True when the event is fired before execution of the operation, and False after execution of the operation. Handling the event before execution provides an opportunity to use custom logic to determine whether the operation should be denied, diverted, or otherwise modified. A corresponding custom response also may be sent to the client (see the event's documentation for details). Handling the event after execution provides an opportunity to report success or any errors related to the operation to the client.
Supported Commands
The following commands are supported by the component. Additional commands may be implemented by handling the Command event.
| ABOR | ADAT | ALLO | APPE | AUTH |
| CDUP | CLNT | CWD | DELE | EPRT |
| EPSV | FEAT | HASH | HELP | LIST |
| MDTM | MFMT | MKD | MLSD | MLST |
| MODE | NLST | NOOP | OPTS | PASS |
| PASV | PBSZ | PORT | PROT | PWD |
| QUIT | REST | RETR | RMD | RNFR |
| RNTO | SITE | SIZE | STOR | STOU |
| SYST | TYPE | USER |
Threading in Server Applications
In .NET, all socket-based components perform all Socket.IO through asynchronous methods. Each call consumes a thread from the system's thread pool, and thus the number of concurrent calls is limited to the number of worker threads returned by System.Threading.ThreadPool.GetMaxThreads. When using several components that can each create a socket connection or a single component that can create multiple socket connections, the application may enter a state in which all of the pool threads are in use for receiving. In a scenario such as this, the remote hosts may be waiting for data from the application before sending, but the application cannot send that data because all the threads are tied up waiting for inbound data. This is particularly important for server applications that use a daemon component.
For example, say a server application 'S' has a max thread pool size of three, and clients 'A' and 'B' connect to it and each client uploads a large file. After all uploads are complete, 'S' enqueues an asynchronous read request in the thread pool for each client. Because no work is being done, the thread pool immediately consumes two threads that wait for any further data from 'A' and 'B'. While 'S' is still processing the first two files it has received, client 'C' connects and uploads a relatively small file. Similarly, once that upload has completed 'S' enqueues a third read request, and the thread pool immediately consumes the third and final thread to wait for further data from 'C'. Once 'S' completes processing any of the files, it will enqueue a send request. However, because all three threads are in use and waiting for data from the clients, the send operation cannot be completed. The entire system becomes deadlocked because each of the clients is waiting for data from the server, which cannot send that data because all of its pool threads are in turn waiting for data from the clients.
To avoid a deadlock situation such as this, it is necessary to ensure that the maximum number of socket connections an application can make is always at least one less than the number of available worker threads. One method to achieve this is to call System.Threading.ThreadPool.SetMaxThreads during the application's startup to set the maximum number of threads to a value high enough to support the application for the duration of its execution. Another option is to trap an event such as ConnectionRequest and Disconnected from each component instance with logic to manage the maximum thread pool size according to the application's current needs.
NOTE: Server components are designed to process events as they occur. To ensure that events are processed in a timely manner, DoEvents should be called in a loop after the server is started.
Property List
The following is the full list of the properties of the component with short descriptions. Click on the links for further details.
| Connections | This is a collection of currently connected clients. |
| DefaultIdleTimeout | This is the default idle timeout in seconds. |
| DefaultRootDir | This is the default local root directory for connecting clients. |
| DefaultTimeout | This property includes an initial timeout value to be used by incoming connections. |
| Listening | This property indicates whether the component is listening for incoming connections on LocalPort. |
| LocalHost | The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
| LocalPort | The TCP port in the local host where the component listens. |
| SSLAuthenticateClients | If set to True, the server asks the client(s) for a certificate. |
| SSLCert | The certificate to be used during Secure Sockets Layer (SSL) negotiation. |
| SSLEnabled | This property indicates whether Transport Layer Security/Secure Sockets Layer (TLS/SSL) is enabled. |
| SSLStartMode | This property determines how the component starts the Secure Sockets Layer (SSL) negotiation. |
| Users | This is the collection of users authorized to connect to the server. |
Method List
The following is the full list of the methods of the component with short descriptions. Click on the links for further details.
| AddDirEntry | This methods adds an entry to the list sent to the client during a directory list request. |
| AddUser | This method adds credentials for a new user who is approved to connect to the server. |
| Config | Sets or retrieves a configuration setting. |
| Disconnect | This method disconnects the specified client. |
| DoEvents | This method processes events from the internal message queue. |
| Interrupt | This method interrupts a synchronous send to the remote host. |
| RemoveUser | This method removes a user from the list of those authorized to connect to the server. |
| Reset | This method will reset the component. |
| SetInputStream | This method sets a file stream to be used when a client downloads a file. |
| SetOutputStream | This method sets a file stream to be used when a client uploads a file. |
| Shutdown | This method shuts down the server. |
| StartListening | This method starts listening for incoming connections. |
| StopListening | This method stops listening for new connections. |
Event List
The following is the full list of the events fired by the component with short descriptions. Click on the links for further details.
| Command | This event fires when an unrecognized command is received from a client. |
| Connected | This event fires immediately after a connection completes (or fails). |
| ConnectionRequest | This event fires when a client makes a connection request. |
| DirChange | This event fires during processing of a directory change request. |
| DirCreate | This event fires during processing of a directory creation request. |
| DirList | This event fires during processing of a directory list request. |
| DirRemove | This event fires during processing of a directory remove request. |
| Disconnected | This event fires when a client is disconnected. |
| EndTransfer | This event fires when a transfer of data ends. |
| Error | This includes information about errors during data delivery. |
| FileDelete | This event fires during processing of a file delete request. |
| FileDownload | This event fires during processing of a file download request. |
| FileGetModifiedTime | This event fires during processing of an MDTM command. |
| FileGetSize | This event fires during processing of a SIZE command. |
| FileRename | This event fires during processing of a file rename request. |
| FileUpload | This event fires during processing of a file upload request. |
| Log | This event fires once for each log message. |
| PITrail | This event traces the commands sent to the server, and the respective replies. |
| SSLClientAuthentication | This event fires when the client presents its credentials to the server. |
| SSLConnectionRequest | This event fires when an SSL connection is requested. |
| SSLStatus | This event shows the progress of the secure connection. |
| StartTransfer | This event fires when a transfer of data begins. |
| Transfer | This event fires when bytes are transferred. |
| UserAuthentication | This event fires when a client provides login credentials to the server. |
Config Settings
The following is a list of config settings for the component with short descriptions. Click on the links for further details.
| AllowActiveMode | Whether to allow clients to connect in active mode. |
| AllowCompression | Whether to allow MODE Z compression. |
| ConnectionBacklog | The maximum number of pending connections maintained by the TCP/IP subsystem. |
| DefaultConnectionTimeout | The inactivity timeout applied to SSL and DI connections. |
| DefaultDIInBufferSize | The size in bytes of the incoming queue of the socket. |
| DefaultDIOutBufferSize | The size in bytes of the outgoing queue of the socket. |
| IncludeFiletimeAge | The age in days after which hours and minutes are not included in the timestamp in directory listings. |
| KeepAlive | When True, KEEPALIVE packets are enabled (for long connections). |
| Linger | When set to True, connections are terminated gracefully. |
| PassiveModeAddress | Public IP address to be communicated to the client for Passive mode use. |
| PassiveModePortRange | Range of ports to use in Passive mode connections. |
| WelcomeMessage | The welcome message displayed to connecting clients. |
| AllowedClients | A comma-separated list of host names or IP addresses that can access the component. |
| BindExclusively | Whether or not the component considers a local port reserved for exclusive use. |
| BlockedClients | A comma-separated list of host names or IP addresses that cannot access the component. |
| CloseStreamAfterTransfer | If true, the component will close the upload or download stream after the transfer. |
| DefaultConnectionTimeout | The inactivity timeout applied to the SSL handshake. |
| InBufferSize | The size in bytes of the incoming queue of the socket. |
| KeepAliveInterval | The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received. |
| KeepAliveTime | The inactivity time in milliseconds before a TCP keep-alive packet is sent. |
| MaxConnections | The maximum number of connections available. |
| OutBufferSize | The size in bytes of the outgoing queue of the socket. |
| PreferredDHGroupBits | Size of the Diffie-Hellman group, in bits. |
| TcpNoDelay | Whether or not to delay when sending packets. |
| UseBackgroundThread | Whether threads created by the component are background threads. |
| UseIPv6 | Whether to use IPv6. |
| CACertFilePaths | The paths to CA certificate files when using Mono on Unix/Linux. |
| LogSSLPackets | Controls whether SSL packets are logged when using the internal security API. |
| ReuseSSLSession | Determines if the SSL session is reused. |
| SSLCACerts | A newline separated list of CA certificates to be included when performing an SSL handshake. |
| SSLCheckCRL | Whether to check the Certificate Revocation List for the server certificate. |
| SSLCheckOCSP | Whether to use OCSP to check the status of the server certificate. |
| SSLCipherStrength | The minimum cipher strength used for bulk encryption. |
| SSLClientCACerts | A newline separated list of CA certificates to use during SSL client certificate validation. |
| SSLEnabledCipherSuites | The cipher suite to be used in an SSL negotiation. |
| SSLEnabledProtocols | Used to enable/disable the supported security protocols. |
| SSLEnableRenegotiation | Whether the renegotiation_info SSL extension is supported. |
| SSLIncludeCertChain | Whether the entire certificate chain is included in the SSLServerAuthentication event. |
| SSLKeyLogFile | The location of a file where per-session secrets are written for debugging purposes. |
| SSLNegotiatedCipher | Returns the negotiated cipher suite. |
| SSLNegotiatedCipherStrength | Returns the negotiated cipher suite strength. |
| SSLNegotiatedCipherSuite | Returns the negotiated cipher suite. |
| SSLNegotiatedKeyExchange | Returns the negotiated key exchange algorithm. |
| SSLNegotiatedKeyExchangeStrength | Returns the negotiated key exchange algorithm strength. |
| SSLNegotiatedVersion | Returns the negotiated protocol version. |
| SSLSecurityFlags | Flags that control certificate verification. |
| SSLServerCACerts | A newline separated list of CA certificates to use during SSL server certificate validation. |
| TLS12SignatureAlgorithms | Defines the allowed TLS 1.2 signature algorithms when SSLProvider is set to Internal. |
| TLS12SupportedGroups | The supported groups for ECC. |
| TLS13KeyShareGroups | The groups for which to pregenerate key shares. |
| TLS13SignatureAlgorithms | The allowed certificate signature algorithms. |
| TLS13SupportedGroups | The supported groups for (EC)DHE key exchange. |
Connections Property (FTPServer Component)
This is a collection of currently connected clients.
Syntax
public FTPConnectionMap Connections { get; }
Public ReadOnly Property Connections As FTPConnectionMap
Remarks
This is a collection of FTPConnection elements that contain information about each connected client.
This property is read-only and not available at design time.
Please refer to the FTPConnection type for a complete list of fields.DefaultIdleTimeout Property (FTPServer Component)
This is the default idle timeout in seconds.
Syntax
Default Value
0
Remarks
This setting optionally specifies an idle timeout for all connected clients. If a connected client does not issue a command within DefaultIdleTimeout seconds, it automatically will be disconnected. The special value 0 indicates that no timeout is specified.
The default value is 0 (no timeout).
This property is not available at design time.
DefaultRootDir Property (FTPServer Component)
This is the default local root directory for connecting clients.
Syntax
Default Value
""
Remarks
This property defines the local root directory for users with an empty local root directory value.
This property is not available at design time.
DefaultTimeout Property (FTPServer Component)
This property includes an initial timeout value to be used by incoming connections.
Syntax
Default Value
0
Remarks
This property is used by the component to set the operational timeout value of all inbound connections once they are established.
This property defines the timeout when sending data. When SSLEnabled is False, a value of 0 means data will be sent asynchronously, and a positive value means data is sent synchronously.
When SSLEnabled is True, all data are sent synchronously regardless of the Timeout value.
Listening Property (FTPServer Component)
This property indicates whether the component is listening for incoming connections on LocalPort.
Syntax
Default Value
False
Remarks
This property indicates whether the component is listening for connections on the port specified by the LocalPort property. Use the StartListening and StopListening methods to control whether the component is listening.
This property is read-only and not available at design time.
LocalHost Property (FTPServer Component)
The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
Syntax
Default Value
""
Remarks
This property contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the IP address of an interface will make the component initiate connections (or accept in the case of server components) only through that interface. It is recommended to provide an IP address rather than a hostname when setting this property to ensure the desired interface is used.
If the component is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).
NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.
LocalPort Property (FTPServer Component)
The TCP port in the local host where the component listens.
Syntax
Default Value
21
Remarks
This property must be set before the component can start listening. If its value is 0, then the TCP/IP subsystem picks a port number at random. The port number can be found by checking the value of this property after the component is listening (i.e., after successfully assigning True to the Listening property).
Because the service port is not shared among servers, two components cannot be listening on the same port at the same time.
SSLAuthenticateClients Property (FTPServer Component)
If set to True, the server asks the client(s) for a certificate.
Syntax
Default Value
False
Remarks
This property is used in conjunction with the SSLClientAuthentication event. Please refer to the documentation of the SSLClientAuthentication event for details.
SSLCert Property (FTPServer Component)
The certificate to be used during Secure Sockets Layer (SSL) negotiation.
Syntax
public Certificate SSLCert { get; set; }
Public Property SSLCert As Certificate
Remarks
This property includes the digital certificate that the component will use during SSL negotiation. Set this property to a valid certificate before starting SSL negotiation. To set a certificate, you may set the Encoded field to the encoded certificate. To select a certificate, use the store and subject fields.
Please refer to the Certificate type for a complete list of fields.SSLEnabled Property (FTPServer Component)
This property indicates whether Transport Layer Security/Secure Sockets Layer (TLS/SSL) is enabled.
Syntax
Default Value
False
Remarks
This property specifies whether TLS/SSL is enabled in the component. When False (default), the component operates in plaintext mode. When True, TLS/SSL is enabled.
TLS/SSL may also be enabled by setting SSLStartMode. Setting SSLStartMode will automatically update this property value.
This property is not available at design time.
SSLStartMode Property (FTPServer Component)
This property determines how the component starts the Secure Sockets Layer (SSL) negotiation.
Syntax
public FTPServerSSLStartModes SSLStartMode { get; set; }
enum FTPServerSSLStartModes { sslAutomatic, sslImplicit, sslExplicit, sslNone }
Public Property SSLStartMode As FtpserverSSLStartModes
Enum FTPServerSSLStartModes sslAutomatic sslImplicit sslExplicit sslNone End Enum
Default Value
3
Remarks
The SSLStartMode property may have one of the following values:
| 0 (sslAutomatic) | If the remote port is set to the standard plaintext port of the protocol (where applicable), the component will behave the same as if SSLStartMode is set to sslExplicit. In all other cases, SSL negotiation will be implicit (sslImplicit). |
| 1 (sslImplicit) | The SSL negotiation will start immediately after the connection is established. |
| 2 (sslExplicit) | The component will first connect in plaintext, and then will explicitly start SSL negotiation through a protocol command such as STARTTLS. |
| 3 (sslNone - default) | No SSL negotiation; no SSL security. All communication will be in plaintext mode. |
Users Property (FTPServer Component)
This is the collection of users authorized to connect to the server.
Syntax
public FTPUserList Users { get; }
Public ReadOnly Property Users As FTPUserList
Remarks
This is the collection of FTPUser elements that contains the names, passwords, home directories, and access policies for users approved to connect to the server.
This property is read-only and not available at design time.
Please refer to the FTPUser type for a complete list of fields.AddDirEntry Method (FTPServer Component)
This methods adds an entry to the list sent to the client during a directory list request.
Syntax
Remarks
This method adds a file or directory (depending on isFile) to the directory contents list sent to the client when DirList is fired. This method can be called only during DirList. A connectionId and name must be specified regardless of which directory list commands are supported.
To support all directory list commands (MLST, NLST, MLSD, LIST), all parameters except for others (which may be an empty string) must be set to valid values. If a parameter is not applicable to a command issued by a client, its value will be ignored and will not be sent to the client.
others contains optional, less common fields and should be a key-value string in the format filetype=l;owner=ownerName;ownergroup=groupName;linkname=linkname.txt;nlink=5.
The following table outlines the available parameters, applicable commands, and their accepted values and formats. Unless otherwise noted, each parameter is required for all applicable commands.
| Parameter | Commands | Description |
| connectionId | MLST, NLST, MLSD, LIST | The connection Id of the client for which the entry will be added. |
| name | MLST, MLSD, LIST | The name of the file or directory entry. |
| size | MLST, MLSD, LIST | The size of the file in bytes. Applicable only to files. |
| modifiedTime | MLST, MLSD, LIST | The date/time the file was modified. Must be in the format yyyyMMddHHmmss. |
| isFile | MLST, MLSD, LIST | Whether the entry represents a file or directory. |
| permission | LIST | A three-digit integer representing the permissions for the owner, group, and world in that order. Each digit will be interpreted as an octal digit containing the read, write, and execute (rwx) permissions represented by its three binary digits in that order. For example, a digit value 0 is no permissions, 4 is read-only, and 7 is full rwx permissions. A three-digit value of 740 would indicate full owner permissions, read-only owner group permissions, and no permissions for all others. |
| filetype | LIST | Optional; within others. A single character specifying the type of entry represented. Possible values are - (ordinary file), d (directory), l (link), s (local socket), b block special file, c (character special file), or p (FIFO special file). If unspecified, this value will be set automatically based on the values of isFile and linkname. If linkname is set, the value will be l otherwise it will be - or d depending on isFile. |
| linkname | LIST | Optional; within others. The path the entry links to. Applicable only to entries with filetype link. If this value is set and filetype is not, filetype will be l automatically. The default value is "". |
| nlink | LIST | Optional; within others. Number of links to the entry. Default is 1. |
| owner | LIST | Optional; within others. The user who owns the file. The default is the username of the currently connected client. |
| ownergroup | LIST | Optional; within others. The group associated with the file. The default is the username of the currently connected client. |
When the method is called, the component will use the command that triggered the DirList event to be fired to determine the parameters and format to be used in the Response. It will build an entry string that will be added to the Response parameter and sent to the client. The method can be called repeatedly to add multiple entries to the directory contents returned.
The Response parameter also may be used to send already-formatted, complete directory entries to the client. Simply append a new line and the entry string to the Response string to add a raw entry this way.
AddUser Method (FTPServer Component)
This method adds credentials for a new user who is approved to connect to the server.
Syntax
Remarks
Define a user name that is allowed to connect to the server, along with that user's password, home directory, and permissions. The user will be added to the Users property.
The name parameter must be a username unique to this user.
rootDir is the local root directory for the user. If an empty string is set, the DefaultRootDir will be used upon connection.
HomeDir is the directory that will be the initial working directory for the user upon login. To use the same location as the RootDir, set it to an empty string or /. Otherwise, this value must be a virtual path relative to RootDir (or DefaultRootDir if applicable). Users may navigate up from their HomeDir as long as they do not navigate above their RootDir, which they are not able to leave. An example of the meanings of the two values follows:
| RootDir | HomeDir | Full local home path |
| C:/FTPServer | /Users/Me | C:/FTPServer/Users/Me |
The ACL parameter controls the access policy for the user and can have the following values:
- 0x0001: ACL_DIR_CREATE
- 0x0002: ACL_DIR_REMOVE
- 0x0100: ACL_FILE_UPLOAD
- 0x0200: ACL_FILE_DELETE
- 0x0400: ACL_FILE_RENAME
- 0xFFFF: ACL_ALL
The credentials of clients attempting to connect to the server also may be validated using the UserAuthentication event.
Config Method (FTPServer Component)
Sets or retrieves a configuration setting.
Syntax
Remarks
Config is a generic method available in every component. It is used to set and retrieve configuration settings for the component.
These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, access to these internal properties is provided through the Config method.
To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.
Disconnect Method (FTPServer Component)
This method disconnects the specified client.
Syntax
Remarks
Calling this method will disconnect the client specified by the ConnectionId parameter.
DoEvents Method (FTPServer Component)
This method processes events from the internal message queue.
Syntax
public void DoEvents();
Public Sub DoEvents()
Remarks
When DoEvents is called, the component processes any available events. If no events are available, it waits for a preset period of time, and then returns.
Interrupt Method (FTPServer Component)
This method interrupts a synchronous send to the remote host.
Syntax
Remarks
This property is called using the Connection Id if you wish to interrupt a connection and stop a file from uploading without disconnecting the client connected to the component. If you use SendFile to upload a file, the component will run synchronously on that Connection Id until it is completed.
RemoveUser Method (FTPServer Component)
This method removes a user from the list of those authorized to connect to the server.
Syntax
Remarks
This method removes the user with the specified name from the Users list. This user will no longer be authorized to connect to the server.
Reset Method (FTPServer Component)
This method will reset the component.
Syntax
public void Reset();
Public Sub Reset()
Remarks
This method will reset the component's properties to their default values.
SetInputStream Method (FTPServer Component)
This method sets a file stream to be used when a client downloads a file.
Syntax
public void SetInputStream(string connectionId, System.IO.Stream s);
Public Sub SetInputStream(ByVal connectionId As String, ByVal s As System.IO.Stream)
Remarks
If set, the component will use the specified stream for the download of a file.
This method can be called within the FileDownload event to set a stream for downloading a "virtual" file, which exists at a remote location other than the one requested by the client. If this method is not called during the event, an input stream will be created at the given filename within the current remote path.
For more details on the file download process, see FileDownload.
SetOutputStream Method (FTPServer Component)
This method sets a file stream to be used when a client uploads a file.
Syntax
public void SetOutputStream(string connectionId, System.IO.Stream s);
Public Sub SetOutputStream(ByVal connectionId As String, ByVal s As System.IO.Stream)
Remarks
If set, the component will use the specified stream for a file upload.
This method can be called within the FileUpload event to set a stream for uploading a file from the client machine to a location other than the one set by the client. If this method is not called during the event, an output stream will be created at the remote path set by the client.
For more details on the file upload process, see FileUpload.
Shutdown Method (FTPServer Component)
This method shuts down the server.
Syntax
public void Shutdown();
Public Sub Shutdown()
Remarks
This method shuts down the server. Calling this method is equivalent to calling StopListening and then breaking every client connection by calling Disconnect.
StartListening Method (FTPServer Component)
This method starts listening for incoming connections.
Syntax
public void StartListening();
Public Sub StartListening()
Remarks
This method begins listening for incoming connections on the port specified by LocalPort. Once listening, events will fire as new clients connect and data are transferred.
To stop listening for new connections, call StopListening. To stop listening for new connections and to disconnect all existing clients, call Shutdown.
StopListening Method (FTPServer Component)
This method stops listening for new connections.
Syntax
public void StopListening();
Public Sub StopListening()
Remarks
This method stops listening for new connections. After being called, any new connection attempts will be rejected. Calling this method does not disconnect existing connections.
To stop listening and to disconnect all existing clients, call Shutdown instead.
Command Event (FTPServer Component)
This event fires when an unrecognized command is received from a client.
Syntax
public event OnCommandHandler OnCommand; public delegate void OnCommandHandler(object sender, FTPServerCommandEventArgs e); public class FTPServerCommandEventArgs : EventArgs { public string ConnectionId { get; } public string Command { get; } public string Parameters { get; } public string Response { get; set; } }
Public Event OnCommand As OnCommandHandler Public Delegate Sub OnCommandHandler(sender As Object, e As FTPServerCommandEventArgs) Public Class FTPServerCommandEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property Command As String Public ReadOnly Property Parameters As String Public Property Response As String End Class
Remarks
This event fires when a command other than those listed below is sent to the server. The server may use its own logic to process such custom commands and may set Response to the desired value.
The ConnectionId is the Id of the connected client that caused the event to fire.
Command is the command sent by the client. Any of the following commands will not fire this event and instead will be processed by the component (custom processing must be done in the respective command-specific events).
| ABOR | ADAT | ALLO | APPE | AUTH |
| CDUP | CLNT | CWD | DELE | EPRT |
| EPSV | FEAT | HASH | HELP | LIST |
| MDTM | MFMT | MKD | MLSD | MLST |
| MODE | NLST | NOOP | OPTS | PASS |
| PASV | PBSZ | PORT | PROT | PWD |
| QUIT | REST | RETR | RMD | RNFR |
| RNTO | SITE | SIZE | STOR | STOU |
| SYST | TYPE | USER |
Parameters is a string containing any parameters following the command sent by the client, such as a username following the USER command. The string contains all characters following the command itself and the next space.
The Response will be sent back to the client and is determined by the custom command and server logic.
Connected Event (FTPServer Component)
This event fires immediately after a connection completes (or fails).
Syntax
public event OnConnectedHandler OnConnected; public delegate void OnConnectedHandler(object sender, FTPServerConnectedEventArgs e); public class FTPServerConnectedEventArgs : EventArgs { public string ConnectionId { get; } }
Public Event OnConnected As OnConnectedHandler Public Delegate Sub OnConnectedHandler(sender As Object, e As FTPServerConnectedEventArgs) Public Class FTPServerConnectedEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String End Class
Remarks
This event fires at the end of the connection process. It fires again for Secure Sockets Layer (SSL) negotiation.
The ConnectionId is the Id of the connected client that caused the event to fire.
ConnectionRequest Event (FTPServer Component)
This event fires when a client makes a connection request.
Syntax
public event OnConnectionRequestHandler OnConnectionRequest; public delegate void OnConnectionRequestHandler(object sender, FTPServerConnectionRequestEventArgs e); public class FTPServerConnectionRequestEventArgs : EventArgs { public string Address { get; } public int Port { get; } public bool Accept { get; set; } }
Public Event OnConnectionRequest As OnConnectionRequestHandler Public Delegate Sub OnConnectionRequestHandler(sender As Object, e As FTPServerConnectionRequestEventArgs) Public Class FTPServerConnectionRequestEventArgs Inherits EventArgs Public ReadOnly Property Address As String Public ReadOnly Property Port As Integer Public Property Accept As Boolean End Class
Remarks
This event indicates an incoming connection. The connection is accepted by default. Address and Port will contain information about the client requesting the inbound connection. If you want to refuse it, you can set the Accept parameter to False.
DirChange Event (FTPServer Component)
This event fires during processing of a directory change request.
Syntax
public event OnDirChangeHandler OnDirChange; public delegate void OnDirChangeHandler(object sender, FTPServerDirChangeEventArgs e); public class FTPServerDirChangeEventArgs : EventArgs { public string ConnectionId { get; } public string OldDirectory { get; } public string NewDirectory { get; } public bool BeforeExec { get; } public int ErrorCode { get; set; } public string ErrorDesc { get; set; } }
Public Event OnDirChange As OnDirChangeHandler Public Delegate Sub OnDirChangeHandler(sender As Object, e As FTPServerDirChangeEventArgs) Public Class FTPServerDirChangeEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property OldDirectory As String Public ReadOnly Property NewDirectory As String Public ReadOnly Property BeforeExec As Boolean Public Property ErrorCode As Integer Public Property ErrorDesc As String End Class
Remarks
This event is fired when the client requests that the working directory be changed.
The ConnectionId is the Id of the connected client that caused the event to fire.
OldDirectory is the previous working directory for this client, and NewDirectory is the working directory to change to. Both directories are paths with respect to the client's home directory.
BeforeExec and Custom Handling
This event is fired both before and after the requested operation is executed. The BeforeExec parameter will be True before execution by the component and False afterwords. Handling the event before execution provides an opportunity to use custom logic to determine whether the operation should be denied, diverted, or otherwise modified. Handling the event after execution provides an opportunity to process the results of the execution or set a custom value to be returned to the client.
NOTE: If ErrorCode is set to a non-zero value when BeforeExec is True, the component will not execute the operation and will send an error to the client. When BeforeExec is False, the values of ErrorCode and ErrorDesc will reflect the success or reason for failure of the executed operation. In either case, they may be set by the server to reflect the result of custom processing.
DirCreate Event (FTPServer Component)
This event fires during processing of a directory creation request.
Syntax
public event OnDirCreateHandler OnDirCreate; public delegate void OnDirCreateHandler(object sender, FTPServerDirCreateEventArgs e); public class FTPServerDirCreateEventArgs : EventArgs { public string ConnectionId { get; } public string Directory { get; } public bool BeforeExec { get; } public int ErrorCode { get; set; } public string ErrorDesc { get; set; } }
Public Event OnDirCreate As OnDirCreateHandler Public Delegate Sub OnDirCreateHandler(sender As Object, e As FTPServerDirCreateEventArgs) Public Class FTPServerDirCreateEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property Directory As String Public ReadOnly Property BeforeExec As Boolean Public Property ErrorCode As Integer Public Property ErrorDesc As String End Class
Remarks
This event is fired when the client requests that a directory be created.
The ConnectionId is the Id of the connected client that caused the event to fire.
BeforeExec and Custom Handling
This event is fired both before and after the requested operation is executed. The BeforeExec parameter will be True before execution by the component and False afterwords. Handling the event before execution provides an opportunity to use custom logic to determine whether the operation should be denied, diverted, or otherwise modified. Handling the event after execution provides an opportunity to process the results of the execution or set a custom value to be returned to the client.
NOTE: If ErrorCode is set to a non-zero value when BeforeExec is True, the component will not execute the operation and will send an error to the client. When BeforeExec is False, the values of ErrorCode and ErrorDesc will reflect the success or reason for failure of the executed operation. In either case, they may be set by the server to reflect the result of custom processing.
DirList Event (FTPServer Component)
This event fires during processing of a directory list request.
Syntax
public event OnDirListHandler OnDirList; public delegate void OnDirListHandler(object sender, FTPServerDirListEventArgs e); public class FTPServerDirListEventArgs : EventArgs { public string ConnectionId { get; } public string Directory { get; } public string Command { get; } public bool BeforeExec { get; } public string LocalDir { get; set; } public string Response { get; set; } public int ErrorCode { get; set; } public string ErrorDesc { get; set; } }
Public Event OnDirList As OnDirListHandler Public Delegate Sub OnDirListHandler(sender As Object, e As FTPServerDirListEventArgs) Public Class FTPServerDirListEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property Directory As String Public ReadOnly Property Command As String Public ReadOnly Property BeforeExec As Boolean Public Property LocalDir As String Public Property Response As String Public Property ErrorCode As Integer Public Property ErrorDesc As String End Class
Remarks
This event is fired when the client requests that the given LocalDir contents be listed.
Directory is the directory to list specified in the command sent by the client. Its value is a virtual path relative to the local root directory for the client.
LocalDir is the full local path of the directory the component will list when it executes the operation. By default, its value is a full path equivalent to the virtual path specified by Directory. However, it may be changed when BeforeExec is True to make the component retrieve list data for the LocalDir value rather than for the one requested by the client. This is especially useful for a virtual filesystem application, in which case the client is requesting lists for directories that do not actually exist at the location specified.
The Response is the directory list data to be sent to the client. Its contents are set automatically during the execution of the list operation by the component, and also can be set manually before or after execution. If set when BeforeExec is True, the component will not execute the operation.
The server also may add directory entries to be sent to the client in the Response using the AddDirEntry method. If entries are added using this method during the first firing of the event, the only entries returned to the client will be the ones added manually. The component will not perform the normal processing of the list request, and the event will not fire a second time.
If no directory is added and no Response or ErrorCode is set during the first time the event fires, the component will process the directory list normally and any entries that exist in the given directory will be sent to the client. Additional entries may be added by calling AddDirEntry during the second firing of the event. In this case, both the automatically and manually added entries will be sent to the client.
The Command argument can be used to determine which parameters need to be specified in the AddDirEntry method. Possible value are MLST, NLST, MLSD, and LIST. For details on usage and which parameters are applicable to which commands, see AddDirEntry.
The ConnectionId is the Id of the connected client that caused the event to fire.
BeforeExec and Custom Handling
This event is fired both before and after the requested operation is executed. The BeforeExec parameter will be True before execution by the component and False afterwords. Handling the event before execution provides an opportunity to use custom logic to determine whether the operation should be denied, diverted, or otherwise modified. Handling the event after execution provides an opportunity to process the results of the execution or set a custom value to be returned to the client.
NOTE: If ErrorCode is set to a non-zero value when BeforeExec is True, the component will not execute the operation and will send an error to the client. When BeforeExec is False, the values of ErrorCode and ErrorDesc will reflect the success or reason for failure of the executed operation. In either case, they may be set by the server to reflect the result of custom processing.
DirRemove Event (FTPServer Component)
This event fires during processing of a directory remove request.
Syntax
public event OnDirRemoveHandler OnDirRemove; public delegate void OnDirRemoveHandler(object sender, FTPServerDirRemoveEventArgs e); public class FTPServerDirRemoveEventArgs : EventArgs { public string ConnectionId { get; } public string Directory { get; } public bool BeforeExec { get; } public int ErrorCode { get; set; } public string ErrorDesc { get; set; } }
Public Event OnDirRemove As OnDirRemoveHandler Public Delegate Sub OnDirRemoveHandler(sender As Object, e As FTPServerDirRemoveEventArgs) Public Class FTPServerDirRemoveEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property Directory As String Public ReadOnly Property BeforeExec As Boolean Public Property ErrorCode As Integer Public Property ErrorDesc As String End Class
Remarks
This event is fired when a client requests the given Directory be removed from the server.
The ConnectionId is the Id of the connected client that caused the event to fire.
BeforeExec and Custom Handling
This event is fired both before and after the requested operation is executed. The BeforeExec parameter will be True before execution by the component and False afterwords. Handling the event before execution provides an opportunity to use custom logic to determine whether the operation should be denied, diverted, or otherwise modified. Handling the event after execution provides an opportunity to process the results of the execution or set a custom value to be returned to the client.
NOTE: If ErrorCode is set to a non-zero value when BeforeExec is True, the component will not execute the operation and will send an error to the client. When BeforeExec is False, the values of ErrorCode and ErrorDesc will reflect the success or reason for failure of the executed operation. In either case, they may be set by the server to reflect the result of custom processing.
Disconnected Event (FTPServer Component)
This event fires when a client is disconnected.
Syntax
public event OnDisconnectedHandler OnDisconnected; public delegate void OnDisconnectedHandler(object sender, FTPServerDisconnectedEventArgs e); public class FTPServerDisconnectedEventArgs : EventArgs { public string ConnectionId { get; } }
Public Event OnDisconnected As OnDisconnectedHandler Public Delegate Sub OnDisconnectedHandler(sender As Object, e As FTPServerDisconnectedEventArgs) Public Class FTPServerDisconnectedEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String End Class
Remarks
This event is fired when a client logs off or is disconnected by the server.
The ConnectionId is the Id of the connected client that caused the event to fire.
EndTransfer Event (FTPServer Component)
This event fires when a transfer of data ends.
Syntax
public event OnEndTransferHandler OnEndTransfer; public delegate void OnEndTransferHandler(object sender, FTPServerEndTransferEventArgs e); public class FTPServerEndTransferEventArgs : EventArgs { public string ConnectionId { get; } public string FileName { get; } public int Direction { get; } public int ErrorCode { get; } public string ErrorDesc { get; } }
Public Event OnEndTransfer As OnEndTransferHandler Public Delegate Sub OnEndTransferHandler(sender As Object, e As FTPServerEndTransferEventArgs) Public Class FTPServerEndTransferEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property FileName As String Public ReadOnly Property Direction As Integer Public ReadOnly Property ErrorCode As Integer Public ReadOnly Property ErrorDesc As String End Class
Remarks
This event is fired at the end of the upload or download of a file FileName. See FileDownload and FileUpload for details on the steps to process transfer requests.
The ConnectionId is the Id of the connected client that caused the event to fire.
The Direction parameter shows whether the client (0) or the server (1) is sending the data.
The values of ErrorCode and ErrorDesc will be non-zero and non-empty, respectively, if any error occurred during the transfer. For a list of valid error codes and their descriptions, please refer to the Error Codes section.
Error Event (FTPServer Component)
This includes information about errors during data delivery.
Syntax
public event OnErrorHandler OnError; public delegate void OnErrorHandler(object sender, FTPServerErrorEventArgs e); public class FTPServerErrorEventArgs : EventArgs { public string ConnectionId { get; } public int ErrorCode { get; } public string Description { get; } }
Public Event OnError As OnErrorHandler Public Delegate Sub OnErrorHandler(sender As Object, e As FTPServerErrorEventArgs) Public Class FTPServerErrorEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property ErrorCode As Integer Public ReadOnly Property Description As String End Class
Remarks
The Error event is fired in case of exceptional conditions during message processing. Normally, the component throws an exception.
ConnectionId is the associated client Id, ErrorCode contains an error code, and Description contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the Error Codes section.
FileDelete Event (FTPServer Component)
This event fires during processing of a file delete request.
Syntax
public event OnFileDeleteHandler OnFileDelete; public delegate void OnFileDeleteHandler(object sender, FTPServerFileDeleteEventArgs e); public class FTPServerFileDeleteEventArgs : EventArgs { public string ConnectionId { get; } public string FileName { get; } public bool BeforeExec { get; } public int ErrorCode { get; set; } public string ErrorDesc { get; set; } }
Public Event OnFileDelete As OnFileDeleteHandler Public Delegate Sub OnFileDeleteHandler(sender As Object, e As FTPServerFileDeleteEventArgs) Public Class FTPServerFileDeleteEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property FileName As String Public ReadOnly Property BeforeExec As Boolean Public Property ErrorCode As Integer Public Property ErrorDesc As String End Class
Remarks
This event is fired when a client requests that a file FileName be deleted from the server.
The ConnectionId is the Id of the connected client that caused the event to fire.
BeforeExec and Custom Handling
This event is fired both before and after the requested operation is executed. The BeforeExec parameter will be True before execution by the component and False afterwords. Handling the event before execution provides an opportunity to use custom logic to determine whether the operation should be denied, diverted, or otherwise modified. Handling the event after execution provides an opportunity to process the results of the execution or set a custom value to be returned to the client.
NOTE: If ErrorCode is set to a non-zero value when BeforeExec is True, the component will not execute the operation and will send an error to the client. When BeforeExec is False, the values of ErrorCode and ErrorDesc will reflect the success or reason for failure of the executed operation. In either case, they may be set by the server to reflect the result of custom processing.
FileDownload Event (FTPServer Component)
This event fires during processing of a file download request.
Syntax
public event OnFileDownloadHandler OnFileDownload; public delegate void OnFileDownloadHandler(object sender, FTPServerFileDownloadEventArgs e); public class FTPServerFileDownloadEventArgs : EventArgs { public string ConnectionId { get; } public string FileName { get; } public long StartByte { get; } public bool BeforeExec { get; } public string LocalFile { get; set; } public int ErrorCode { get; set; } public string ErrorDesc { get; set; } }
Public Event OnFileDownload As OnFileDownloadHandler Public Delegate Sub OnFileDownloadHandler(sender As Object, e As FTPServerFileDownloadEventArgs) Public Class FTPServerFileDownloadEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property FileName As String Public ReadOnly Property StartByte As Long Public ReadOnly Property BeforeExec As Boolean Public Property LocalFile As String Public Property ErrorCode As Integer Public Property ErrorDesc As String End Class
Remarks
This event is fired when a client requests that a file be transferred to it from the server.
When BeforeExec is True, the event parameters can be used to determine whether to allow the download, inform the client of any error, and specify a file or stream for the download other than the one given by FileName.
The default behavior is for the component to download the file FileName if it exists and to return an invalid path error otherwise. However, the server may use the FileName and ConnectionId to determine whether or not it wishes to allow the download, and which file to actually transfer.
You can transfer a file not located at the path referenced by FileName, such as in the case of "virtual" files, in the following three ways:
- The FileData field of the FTPConnection object associated with the client making the transfer request: simply set this field equal to the data the server should transfer to the client. It can be used only from within this event. See the FTPConnection type for details.
- The SetInputStream method: passes a file stream to be used for the download. See the method documentation for details.
- The LocalFile event argument: specifies the full path to the file on disk from which the component will read data when sending content back to the connected client. This may be modified within this event when BeforeExec is True to instruct the component to transfer a different local file than the one referenced by FileName.
The ConnectionId is the Id of the connected client that caused the event to fire.
The StartByte parameter specifies the index of the byte at which the download should start and is used when the client requests that a download be restarted from a certain point.
Download Request Processing Steps
- A RETR command is received by the component from a client.
- The component sends a "150 opening data channel for file download" message.
- The FileDownload event is fired for the first time with BeforeExec set to True.
- The StartTransfer event is fired when the transfer of data actually begins.
- The Transfer event is fired repeatedly as bytes are transferred.
- The EndTransfer event is fired when the transfer of data is complete.
- The FileDownload event is fired for the second time with BeforeExec set to False.
- The component sends a "226 Successfully transferred" message.
BeforeExec and Custom Handling
This event is fired both before and after the requested operation is executed. The BeforeExec parameter will be True before execution by the component and False afterwords. Handling the event before execution provides an opportunity to use custom logic to determine whether the operation should be denied, diverted, or otherwise modified. Handling the event after execution provides an opportunity to process the results of the execution or set a custom value to be returned to the client.
NOTE: If ErrorCode is set to a non-zero value when BeforeExec is True, the component will not execute the operation and will send an error to the client. When BeforeExec is False, the values of ErrorCode and ErrorDesc will reflect the success or reason for failure of the executed operation. In either case, they may be set by the server to reflect the result of custom processing.
FileGetModifiedTime Event (FTPServer Component)
This event fires during processing of an MDTM command.
Syntax
public event OnFileGetModifiedTimeHandler OnFileGetModifiedTime; public delegate void OnFileGetModifiedTimeHandler(object sender, FTPServerFileGetModifiedTimeEventArgs e); public class FTPServerFileGetModifiedTimeEventArgs : EventArgs { public string ConnectionId { get; } public string FileName { get; } public bool BeforeExec { get; } public string Response { get; set; } public int ErrorCode { get; set; } public string ErrorDesc { get; set; } }
Public Event OnFileGetModifiedTime As OnFileGetModifiedTimeHandler Public Delegate Sub OnFileGetModifiedTimeHandler(sender As Object, e As FTPServerFileGetModifiedTimeEventArgs) Public Class FTPServerFileGetModifiedTimeEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property FileName As String Public ReadOnly Property BeforeExec As Boolean Public Property Response As String Public Property ErrorCode As Integer Public Property ErrorDesc As String End Class
Remarks
This event is fired when the client requests that the component calculate the modified time of a file.
FileName holds the filename for which the client has requested the size.
Response should hold the modified time of the file. The format of the modified time must be yyyyMMddHHmmss.SSS, but the "." and subsequent digits (sss) are optional. Time values are always represented in UTC. If the file exists on disk, the component will automatically populate this value during execution, and it will be available when BeforeExec is False.
Response may be set manually before or after execution, but if it is set before, the component will not calculate the modified time, and the event will not fire a second time.
The ConnectionId is the Id of the connected client that caused the event to fire.
BeforeExec and Custom Handling
This event is fired both before and after the requested operation is executed. The BeforeExec parameter will be True before execution by the component and False afterwords. Handling the event before execution provides an opportunity to use custom logic to determine whether the operation should be denied, diverted, or otherwise modified. Handling the event after execution provides an opportunity to process the results of the execution or set a custom value to be returned to the client.
NOTE: If ErrorCode is set to a non-zero value when BeforeExec is True, the component will not execute the operation and will send an error to the client. When BeforeExec is False, the values of ErrorCode and ErrorDesc will reflect the success or reason for failure of the executed operation. In either case, they may be set by the server to reflect the result of custom processing.
FileGetSize Event (FTPServer Component)
This event fires during processing of a SIZE command.
Syntax
public event OnFileGetSizeHandler OnFileGetSize; public delegate void OnFileGetSizeHandler(object sender, FTPServerFileGetSizeEventArgs e); public class FTPServerFileGetSizeEventArgs : EventArgs { public string ConnectionId { get; } public string FileName { get; } public bool BeforeExec { get; } public string Response { get; set; } public int ErrorCode { get; set; } public string ErrorDesc { get; set; } }
Public Event OnFileGetSize As OnFileGetSizeHandler Public Delegate Sub OnFileGetSizeHandler(sender As Object, e As FTPServerFileGetSizeEventArgs) Public Class FTPServerFileGetSizeEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property FileName As String Public ReadOnly Property BeforeExec As Boolean Public Property Response As String Public Property ErrorCode As Integer Public Property ErrorDesc As String End Class
Remarks
This event is fired when a client requests that the server calculate the size of a file.
FileName holds the filename for which the client has requested the size.
Response should hold the length of the file in bytes. If the file exists on disk, the component will automatically populate this value, and it will be available when BeforeExec is False.
Response may be set manually before or after execution, but if it is set before, the component will not calculate the size, and the event will not fire a second time.
The ConnectionId is the Id of the connected client that caused the event to fire.
BeforeExec and Custom Handling
This event is fired both before and after the requested operation is executed. The BeforeExec parameter will be True before execution by the component and False afterwords. Handling the event before execution provides an opportunity to use custom logic to determine whether the operation should be denied, diverted, or otherwise modified. Handling the event after execution provides an opportunity to process the results of the execution or set a custom value to be returned to the client.
NOTE: If ErrorCode is set to a non-zero value when BeforeExec is True, the component will not execute the operation and will send an error to the client. When BeforeExec is False, the values of ErrorCode and ErrorDesc will reflect the success or reason for failure of the executed operation. In either case, they may be set by the server to reflect the result of custom processing.
FileRename Event (FTPServer Component)
This event fires during processing of a file rename request.
Syntax
public event OnFileRenameHandler OnFileRename; public delegate void OnFileRenameHandler(object sender, FTPServerFileRenameEventArgs e); public class FTPServerFileRenameEventArgs : EventArgs { public string ConnectionId { get; } public string OldFileName { get; } public string NewFileName { get; } public bool BeforeExec { get; } public int ErrorCode { get; set; } public string ErrorDesc { get; set; } }
Public Event OnFileRename As OnFileRenameHandler Public Delegate Sub OnFileRenameHandler(sender As Object, e As FTPServerFileRenameEventArgs) Public Class FTPServerFileRenameEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property OldFileName As String Public ReadOnly Property NewFileName As String Public ReadOnly Property BeforeExec As Boolean Public Property ErrorCode As Integer Public Property ErrorDesc As String End Class
Remarks
This event is fired when a client requests that a file on the server be renamed.
The ConnectionId is the Id of the connected client that caused the event to fire.
OldFileName is the previous name of the file to rename, and NewFileName is the new file name.
BeforeExec and Custom Handling
This event is fired both before and after the requested operation is executed. The BeforeExec parameter will be True before execution by the component and False afterwords. Handling the event before execution provides an opportunity to use custom logic to determine whether the operation should be denied, diverted, or otherwise modified. Handling the event after execution provides an opportunity to process the results of the execution or set a custom value to be returned to the client.
NOTE: If ErrorCode is set to a non-zero value when BeforeExec is True, the component will not execute the operation and will send an error to the client. When BeforeExec is False, the values of ErrorCode and ErrorDesc will reflect the success or reason for failure of the executed operation. In either case, they may be set by the server to reflect the result of custom processing.
FileUpload Event (FTPServer Component)
This event fires during processing of a file upload request.
Syntax
public event OnFileUploadHandler OnFileUpload; public delegate void OnFileUploadHandler(object sender, FTPServerFileUploadEventArgs e); public class FTPServerFileUploadEventArgs : EventArgs { public string ConnectionId { get; } public string FileName { get; } public long StartByte { get; } public bool isAppend { get; } public bool isStoreUnique { get; } public bool BeforeExec { get; } public string LocalFile { get; set; } public int ErrorCode { get; set; } public string ErrorDesc { get; set; } }
Public Event OnFileUpload As OnFileUploadHandler Public Delegate Sub OnFileUploadHandler(sender As Object, e As FTPServerFileUploadEventArgs) Public Class FTPServerFileUploadEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property FileName As String Public ReadOnly Property StartByte As Long Public ReadOnly Property isAppend As Boolean Public ReadOnly Property isStoreUnique As Boolean Public ReadOnly Property BeforeExec As Boolean Public Property LocalFile As String Public Property ErrorCode As Integer Public Property ErrorDesc As String End Class
Remarks
This event is fired when a client requests that a file be transferred from it to the server.
When BeforeExec is True, and the arguments can be used to determine whether to allow the upload, inform the client of any error, and specify a file or stream for the upload other than the one given by FileName.
The default behavior is for the component to upload the file FileName if it exists and the user is permitted to upload, and to return an invalid path error otherwise. However, the server may use the FileName, ConnectionId, and other arguments to determine whether or not it wishes to allow the upload, and the location to actually upload the file to.
You can upload a file to a location other than the one referenced by FileName, such as in the case of "virtual" files, in the following three ways:
- The FileData field of the FTPConnection object associated with the client making the transfer request: the data uploaded will be saved in this field rather than written to disk. To use this method, first set the LocalFile parameter to an empty string to indicate the data will not be written to any disk location. When EndTransfer fires the field will then contain the uploaded file data.
- The SetOutputStream method: passes a file stream to be used for the upload. See the method documentation for details.
- The LocalFile event argument: specifies the full path to the file on disk to which the component will write data when receiving content from the connected client. This may be modified within this event when BeforeExec is True to instruct the component to use a different local file.
The ConnectionId is the Id of the connected client that caused the event to fire.
The StartByte parameter specifies the index of the byte at which the upload should start and is used when the client requests that an upload be restarted from a certain point.
Upload Request Processing Steps
- A STOR, APPE or STOU command is received by the component from a client.
- The component sends a "150 opening data channel for file upload" message.
- The FileUpload event is fired for the first time with BeforeExec set to True.
- The StartTransfer event is fired when the transfer of data actually begins.
- The Transfer event is fired repeatedly as bytes are transferred.
- The EndTransfer event is fired when the transfer of data is complete.
- The FileUpload event is fired for the second time with BeforeExec set to False.
- The component sends a "226 Successfully transferred" message.
BeforeExec and Custom Handling
This event is fired both before and after the requested operation is executed. The BeforeExec parameter will be True before execution by the component and False afterwords. Handling the event before execution provides an opportunity to use custom logic to determine whether the operation should be denied, diverted, or otherwise modified. Handling the event after execution provides an opportunity to process the results of the execution or set a custom value to be returned to the client.
NOTE: If ErrorCode is set to a non-zero value when BeforeExec is True, the component will not execute the operation and will send an error to the client. When BeforeExec is False, the values of ErrorCode and ErrorDesc will reflect the success or reason for failure of the executed operation. In either case, they may be set by the server to reflect the result of custom processing.
Log Event (FTPServer Component)
This event fires once for each log message.
Syntax
public event OnLogHandler OnLog; public delegate void OnLogHandler(object sender, FTPServerLogEventArgs e); public class FTPServerLogEventArgs : EventArgs { public string ConnectionId { get; } public int LogLevel { get; } public string Message { get; } public string LogType { get; } }
Public Event OnLog As OnLogHandler Public Delegate Sub OnLogHandler(sender As Object, e As FTPServerLogEventArgs) Public Class FTPServerLogEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property LogLevel As Integer Public ReadOnly Property Message As String Public ReadOnly Property LogType As String End Class
Remarks
This event fires once for each log message generated by the component. The verbosity is controlled by the LogLevel setting.
LogLevel indicates the level of message. Possible values are as follows:
| 0 (None) | No events are logged. |
| 1 (Info - default) | Informational events are logged. |
| 2 (Verbose) | Detailed data are logged. |
| 3 (Debug) | Debug data are logged. |
The value 1 (Info) logs basic information, including users logging in and out, files transferred, and directories listed.
The value 2 (Verbose) includes logs from the PITrail event as well as basic information about data transfer channels.
The value 3 (Debug) logs additional debug information, such as extended socket connection and data transfer information.
Message is the log entry.
LogType identifies the type of log entry. Possible values are as follows:
- "Info"
- "Error"
- "Verbose"
- "Debug"
- "PITrail"
PITrail Event (FTPServer Component)
This event traces the commands sent to the server, and the respective replies.
Syntax
public event OnPITrailHandler OnPITrail; public delegate void OnPITrailHandler(object sender, FTPServerPITrailEventArgs e); public class FTPServerPITrailEventArgs : EventArgs { public string ConnectionId { get; } public int Direction { get; } public string Message { get; } }
Public Event OnPITrail As OnPITrailHandler Public Delegate Sub OnPITrailHandler(sender As Object, e As FTPServerPITrailEventArgs) Public Class FTPServerPITrailEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property Direction As Integer Public ReadOnly Property Message As String End Class
Remarks
The PITrail event is useful for debugging purposes. It shows all the interaction between the client and the server, line by line.
The Message parameter contains the full text of the message. The Direction parameter shows the originator of the message:
| 0 (Client) | The Message originates from the client. |
| 1 (Server) | The Message originates from the server. |
| 2 (Info) | The Message is an informative message originating from the client software (the component code). |
NOTE: PITrail output is also included in the Log event when the LogLevel configuration setting is set to "Verbose" (2) or higher.
SSLClientAuthentication Event (FTPServer Component)
This event fires when the client presents its credentials to the server.
Syntax
public event OnSSLClientAuthenticationHandler OnSSLClientAuthentication; public delegate void OnSSLClientAuthenticationHandler(object sender, FTPServerSSLClientAuthenticationEventArgs e); public class FTPServerSSLClientAuthenticationEventArgs : EventArgs { public string ConnectionId { get; } public string CertEncoded { get; }
public byte[] CertEncodedB { get; } public string CertSubject { get; } public string CertIssuer { get; } public string Status { get; } public bool Accept { get; set; } }
Public Event OnSSLClientAuthentication As OnSSLClientAuthenticationHandler Public Delegate Sub OnSSLClientAuthenticationHandler(sender As Object, e As FTPServerSSLClientAuthenticationEventArgs) Public Class FTPServerSSLClientAuthenticationEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property CertEncoded As String
Public ReadOnly Property CertEncodedB As Byte() Public ReadOnly Property CertSubject As String Public ReadOnly Property CertIssuer As String Public ReadOnly Property Status As String Public Property Accept As Boolean End Class
Remarks
The server can decide whether or not to continue. The Accept parameter is a recommendation on whether to continue or close the connection. This is just a suggestion: application software must use its own logic to determine whether or not to continue.
When Accept is False, Status shows why the verification failed; otherwise, Status contains the string "OK".
SSLConnectionRequest Event (FTPServer Component)
This event fires when an SSL connection is requested.
Syntax
public event OnSSLConnectionRequestHandler OnSSLConnectionRequest; public delegate void OnSSLConnectionRequestHandler(object sender, FTPServerSSLConnectionRequestEventArgs e); public class FTPServerSSLConnectionRequestEventArgs : EventArgs { public string ConnectionId { get; } public string SupportedCipherSuites { get; } public string SupportedSignatureAlgs { get; } public int CertStoreType { get; set; } public string CertStore { get; set; } public string CertPassword { get; set; } public string CertSubject { get; set; } }
Public Event OnSSLConnectionRequest As OnSSLConnectionRequestHandler Public Delegate Sub OnSSLConnectionRequestHandler(sender As Object, e As FTPServerSSLConnectionRequestEventArgs) Public Class FTPServerSSLConnectionRequestEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property SupportedCipherSuites As String Public ReadOnly Property SupportedSignatureAlgs As String Public Property CertStoreType As Integer Public Property CertStore As String Public Property CertPassword As String Public Property CertSubject As String End Class
Remarks
This event fires when an SSL connection is requested and SSLProvider is set to Internal. This event provides an opportunity to select an alternative certificate to the connecting client. This event does not fire when SSLProvider is set to Platform.
This event allows the component to be configured to use both RSA and ECDSA certificates depending on the connecting client's capabilities.
ConnectionId is the connection Id of the client requesting the connection.
SupportedCipherSuites is a comma-separated list of cipher suites that the client supports.
SupportedSignatureAlgs is a comma-separated list of certificate signature algorithms that the client supports.
CertStoreType is the store type of the alternate certificate to use for this connection. The component supports both public and private keys in a variety of formats. When the cstAuto value is used, the component will automatically determine the type. This field can take one of the following values:
| 0 (cstUser - default) | For Windows, this specifies that the certificate store is a certificate store owned by the current user.
NOTE: This store type is not available in Java. |
| 1 (cstMachine) | For Windows, this specifies that the certificate store is a machine store.
NOTE: This store type is not available in Java. |
| 2 (cstPFXFile) | The certificate store is the name of a PFX (PKCS#12) file containing certificates. |
| 3 (cstPFXBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in PFX (PKCS#12) format. |
| 4 (cstJKSFile) | The certificate store is the name of a Java Key Store (JKS) file containing certificates.
NOTE: This store type is only available in Java. |
| 5 (cstJKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in Java Key Store (JKS) format.
NOTE: This store type is only available in Java. |
| 6 (cstPEMKeyFile) | The certificate store is the name of a PEM-encoded file that contains a private key and an optional certificate. |
| 7 (cstPEMKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a private key and an optional certificate. |
| 8 (cstPublicKeyFile) | The certificate store is the name of a file that contains a PEM- or DER-encoded public key certificate. |
| 9 (cstPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a PEM- or DER-encoded public key certificate. |
| 10 (cstSSHPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains an SSH-style public key. |
| 11 (cstP7BFile) | The certificate store is the name of a PKCS#7 file containing certificates. |
| 12 (cstP7BBlob) | The certificate store is a string (binary) representing a certificate store in PKCS#7 format. |
| 13 (cstSSHPublicKeyFile) | The certificate store is the name of a file that contains an SSH-style public key. |
| 14 (cstPPKFile) | The certificate store is the name of a file that contains a PPK (PuTTY Private Key). |
| 15 (cstPPKBlob) | The certificate store is a string (binary) that contains a PPK (PuTTY Private Key). |
| 16 (cstXMLFile) | The certificate store is the name of a file that contains a certificate in XML format. |
| 17 (cstXMLBlob) | The certificate store is a string that contains a certificate in XML format. |
| 18 (cstJWKFile) | The certificate store is the name of a file that contains a JWK (JSON Web Key). |
| 19 (cstJWKBlob) | The certificate store is a string that contains a JWK (JSON Web Key). |
| 21 (cstBCFKSFile) | The certificate store is the name of a file that contains a BCFKS (Bouncy Castle FIPS Key Store).
NOTE: This store type is only available in Java and .NET. |
| 22 (cstBCFKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in BCFKS (Bouncy Castle FIPS Key Store) format.
NOTE: This store type is only available in Java and .NET. |
| 23 (cstPKCS11) | The certificate is present on a physical security key accessible via a PKCS#11 interface.
To use a security key, create a new Certificate object and pass cstPKCS11 as the StoreType, the full path of the PKCS#11 DLL as the Store, and the PIN as the StorePassword. Code Example. SSH Authentication with Security Key (without CertMgr):
Alternatively, collect the necessary data using the CertMgr component by calling the ListStoreCertificates method after setting the corresponding properties accordingly. The certificate information returned in the CertList event's CertEncoded parameter may be saved for later use. When using a certificate obtained with this approach, pass the previously saved security key information as the Store and set StorePassword to the PIN. Code Example. SSH Authentication with Security Key (with CertMgr):
|
| 99 (cstAuto) | The store type is automatically detected from the input data. This setting may be used with both public and private keys and can detect any of the supported formats automatically. |
CertStore is the store name or location of the alternate certificate to use for this connection.
Designations of certificate stores are platform dependent.
The following designations are the most common User and Machine certificate stores in Windows:
| MY | A certificate store holding personal certificates with their associated private keys. |
| CA | Certifying authority certificates. |
| ROOT | Root certificates. |
When the certificate store type is cstPFXFile, this property must be set to the name of the file. When the type is cstPFXBlob, the property must be set to the binary contents of a PFX file (i.e., PKCS#12 certificate store).
CertPassword is the password of the certificate store containing the alternate certificate to use for this connection.
CertSubject is the subject of the alternate certificate to use for this connection.
The special value * matches any subject and will select the first certificate in the store. The certificate subject is a comma-separated list of distinguished name fields and values. For instance, "CN=www.server.com, OU=test, C=US, E=example@email.com". Common fields and their meanings are as follows:
| Field | Meaning |
| CN | Common Name. This is commonly a hostname like www.server.com. |
| O | Organization |
| OU | Organizational Unit |
| L | Locality |
| S | State |
| C | Country |
| E | Email Address |
If a field value contains a comma, it must be quoted.
SSLStatus Event (FTPServer Component)
This event shows the progress of the secure connection.
Syntax
public event OnSSLStatusHandler OnSSLStatus; public delegate void OnSSLStatusHandler(object sender, FTPServerSSLStatusEventArgs e); public class FTPServerSSLStatusEventArgs : EventArgs { public string ConnectionId { get; } public string Message { get; } }
Public Event OnSSLStatus As OnSSLStatusHandler Public Delegate Sub OnSSLStatusHandler(sender As Object, e As FTPServerSSLStatusEventArgs) Public Class FTPServerSSLStatusEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property Message As String End Class
Remarks
The event is fired for informational and logging purposes only. It is used to track the progress of the connection.
StartTransfer Event (FTPServer Component)
This event fires when a transfer of data begins.
Syntax
public event OnStartTransferHandler OnStartTransfer; public delegate void OnStartTransferHandler(object sender, FTPServerStartTransferEventArgs e); public class FTPServerStartTransferEventArgs : EventArgs { public string ConnectionId { get; } public string FileName { get; } public int Direction { get; } }
Public Event OnStartTransfer As OnStartTransferHandler Public Delegate Sub OnStartTransferHandler(sender As Object, e As FTPServerStartTransferEventArgs) Public Class FTPServerStartTransferEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property FileName As String Public ReadOnly Property Direction As Integer End Class
Remarks
This event fires at the start of the upload or download of a file FileName. See FileDownload and FileUpload for details on steps in the processing of transfer requests.
The ConnectionId is the Id of the connected client that caused the event to fire.
The Direction parameter shows whether the client (0) or the server (1) is sending the data.
Transfer Event (FTPServer Component)
This event fires when bytes are transferred.
Syntax
public event OnTransferHandler OnTransfer; public delegate void OnTransferHandler(object sender, FTPServerTransferEventArgs e); public class FTPServerTransferEventArgs : EventArgs { public string ConnectionId { get; } public string FileName { get; } public int Direction { get; } public long BytesTransferred { get; } public string Text { get; }
public byte[] TextB { get; } }
Public Event OnTransfer As OnTransferHandler Public Delegate Sub OnTransferHandler(sender As Object, e As FTPServerTransferEventArgs) Public Class FTPServerTransferEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property FileName As String Public ReadOnly Property Direction As Integer Public ReadOnly Property BytesTransferred As Long Public ReadOnly Property Text As String
Public ReadOnly Property TextB As Byte() End Class
Remarks
This event fires repeatedly as bytes are transferred between client and server. See FileDownload and FileUpload for details on steps in the processing of transfer requests.
The BytesTransferred parameter shows the number of bytes transferred since the beginning of the transfer.
Text contains the portion of the file data being delivered.
The Direction parameter shows whether the client (0) or the server (1) is sending the data.
NOTE: Events are not re-entrant. Performing time-consuming operations within this event will prevent it from firing again in a timely manner and may affect overall performance.
UserAuthentication Event (FTPServer Component)
This event fires when a client provides login credentials to the server.
Syntax
public event OnUserAuthenticationHandler OnUserAuthentication; public delegate void OnUserAuthenticationHandler(object sender, FTPServerUserAuthenticationEventArgs e); public class FTPServerUserAuthenticationEventArgs : EventArgs { public string ConnectionId { get; } public string Address { get; } public int Port { get; } public string User { get; } public string Password { get; } public string RootDir { get; set; } public string HomeDir { get; set; } public bool Accept { get; set; } }
Public Event OnUserAuthentication As OnUserAuthenticationHandler Public Delegate Sub OnUserAuthenticationHandler(sender As Object, e As FTPServerUserAuthenticationEventArgs) Public Class FTPServerUserAuthenticationEventArgs Inherits EventArgs Public ReadOnly Property ConnectionId As String Public ReadOnly Property Address As String Public ReadOnly Property Port As Integer Public ReadOnly Property User As String Public ReadOnly Property Password As String Public Property RootDir As String Public Property HomeDir As String Public Property Accept As Boolean End Class
Remarks
This event fires when the PASS command is received for the user currently attempting to connect. This event allows the server to use its own logic to decide whether to accept or reject a client connection based on their user credentials and connection information.
Accept can be set to control if the component should proceed with the connection for the user. By default, Accept will be True if the user credentials provided are in the Users collection and otherwise will be False. In either case, the value may be set within the method based on application logic to override this default authentication behavior. Such a change will be applied only to the current connection and not to future connections for this user.
RootDir is the local root directory for the user. If the credentials for this User have been added to Users, its default value will be the value specified in the call to AddUser. Otherwise, its default value will be DefaultRootDir. To set a different root for this connection, change the value of RootDir in this event. Such a change will be applied only to the current connection and not to future connections for this user.
HomeDir is the directory that will be the initial working directory for the user upon login. To use the same location as the RootDir, set it to an empty string or /. Otherwise, this value must be a virtual path relative to RootDir (or DefaultRootDir if applicable). Users may navigate up from their HomeDir as long as they do not navigate above their RootDir, which they are not able to leave. An example of the meanings of the two values follows:
| RootDir | HomeDir | Full local home path |
| C:/FTPServer | /Users/Me | C:/FTPServer/Users/Me |
Address and Port are the address and port of the client attempting authentication.
User and Password are the credentials of the client attempting authentication.
The ConnectionId is the Id of the connected client that caused the event to fire.
Certificate Type
This is the digital certificate being used.
Remarks
This type describes the current digital certificate. The certificate may be a public or private key. The fields are used to identify or select certificates.
- EffectiveDate
- ExpirationDate
- ExtendedKeyUsage
- Fingerprint
- FingerprintSHA1
- FingerprintSHA256
- Issuer
- PrivateKey
- PrivateKeyAvailable
- PrivateKeyContainer
- PublicKey
- PublicKeyAlgorithm
- PublicKeyLength
- SerialNumber
- SignatureAlgorithm
- Store
- StorePassword
- StoreType
- SubjectAltNames
- ThumbprintMD5
- ThumbprintSHA1
- ThumbprintSHA256
- Usage
- UsageFlags
- Version
- Subject
- Encoded
Fields
EffectiveDate
string (read-only)
Default:
""
The date on which this certificate becomes valid. Before this date, it is not valid. The date is localized to the system's time zone. The following example illustrates the format of an encoded date:
23-Jan-2000 15:00:00.
ExpirationDate
string (read-only)
Default:
""
The date on which the certificate expires. After this date, the certificate will no longer be valid. The date is localized to the system's time zone. The following example illustrates the format of an encoded date:
23-Jan-2001 15:00:00.
ExtendedKeyUsage
string (read-only)
Default:
""
A comma-delimited list of extended key usage identifiers. These are the same as ASN.1 object identifiers (OIDs).
Fingerprint
string (read-only)
Default:
""
The hex-encoded, 16-byte MD5 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.
The following example illustrates the format: bc:2a:72:af:fe:58:17:43:7a:5f:ba:5a:7c:90:f7:02
FingerprintSHA1
string (read-only)
Default:
""
The hex-encoded, 20-byte SHA-1 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.
The following example illustrates the format: 30:7b:fa:38:65:83:ff:da:b4:4e:07:3f:17:b8:a4:ed:80:be:ff:84
FingerprintSHA256
string (read-only)
Default:
""
The hex-encoded, 32-byte SHA-256 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.
The following example illustrates the format: 6a:80:5c:33:a9:43:ea:b0:96:12:8a:64:96:30:ef:4a:8a:96:86:ce:f4:c7:be:10:24:8e:2b:60:9e:f3:59:53
Issuer
string (read-only)
Default:
""
The issuer of the certificate. This field contains a string representation of the name of the issuing authority for the certificate.
PrivateKey
string (read-only)
Default:
""
The private key of the certificate (if available). The key is provided as PEM/Base64-encoded data.
NOTE: The PrivateKey may be available but not exportable. In this case, PrivateKey returns an empty string.
PrivateKeyAvailable
bool (read-only)
Default:
False
Whether a PrivateKey is available for the selected certificate. If PrivateKeyAvailable is True, the certificate may be used for authentication purposes (e.g., server authentication).
PrivateKeyContainer
string (read-only)
Default:
""
The name of the PrivateKey container for the certificate (if available). This functionality is available only on Windows platforms.
PublicKey
string (read-only)
Default:
""
The public key of the certificate. The key is provided as PEM/Base64-encoded data.
PublicKeyAlgorithm
string (read-only)
Default:
""
The textual description of the certificate's public key algorithm. The property contains either the name of the algorithm (e.g., "RSA" or "RSA_DH") or an object identifier (OID) string representing the algorithm.
PublicKeyLength
int (read-only)
Default:
0
The length of the certificate's public key (in bits). Common values are 512, 1024, and 2048.
SerialNumber
string (read-only)
Default:
""
The serial number of the certificate encoded as a string. The number is encoded as a series of hexadecimal digits, with each pair representing a byte of the serial number.
SignatureAlgorithm
string (read-only)
Default:
""
The text description of the certificate's signature algorithm. The property contains either the name of the algorithm (e.g., "RSA" or "RSA_MD5RSA") or an object identifier (OID) string representing the algorithm.
Store
string
Default:
"MY"
The name of the certificate store for the client certificate.
The StoreType field denotes the type of the certificate store specified by Store. If the store is password-protected, specify the password in StorePassword.
Store is used in conjunction with the Subject field to specify client certificates. If Store has a value, and Subject or Encoded is set, a search for a certificate is initiated. Please see the Subject field for details.
Designations of certificate stores are platform dependent.
The following designations are the most common User and Machine certificate stores in Windows:
| MY | A certificate store holding personal certificates with their associated private keys. |
| CA | Certifying authority certificates. |
| ROOT | Root certificates. |
When the certificate store type is cstPFXFile, this property must be set to the name of the file. When the type is cstPFXBlob, the property must be set to the binary contents of a PFX file (i.e., PKCS#12 certificate store).
StoreB
byte []
Default:
"MY"
The name of the certificate store for the client certificate.
The StoreType field denotes the type of the certificate store specified by Store. If the store is password-protected, specify the password in StorePassword.
Store is used in conjunction with the Subject field to specify client certificates. If Store has a value, and Subject or Encoded is set, a search for a certificate is initiated. Please see the Subject field for details.
Designations of certificate stores are platform dependent.
The following designations are the most common User and Machine certificate stores in Windows:
| MY | A certificate store holding personal certificates with their associated private keys. |
| CA | Certifying authority certificates. |
| ROOT | Root certificates. |
When the certificate store type is cstPFXFile, this property must be set to the name of the file. When the type is cstPFXBlob, the property must be set to the binary contents of a PFX file (i.e., PKCS#12 certificate store).
StorePassword
string
Default:
""
If the type of certificate store requires a password, this field is used to specify the password needed to open the certificate store.
StoreType
CertStoreTypes
Default:
0
The type of certificate store for this certificate.
The component supports both public and private keys in a variety of formats. When the cstAuto value is used, the component will automatically determine the type. This field can take one of the following values:
| 0 (cstUser - default) | For Windows, this specifies that the certificate store is a certificate store owned by the current user.
NOTE: This store type is not available in Java. |
| 1 (cstMachine) | For Windows, this specifies that the certificate store is a machine store.
NOTE: This store type is not available in Java. |
| 2 (cstPFXFile) | The certificate store is the name of a PFX (PKCS#12) file containing certificates. |
| 3 (cstPFXBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in PFX (PKCS#12) format. |
| 4 (cstJKSFile) | The certificate store is the name of a Java Key Store (JKS) file containing certificates.
NOTE: This store type is only available in Java. |
| 5 (cstJKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in Java Key Store (JKS) format.
NOTE: This store type is only available in Java. |
| 6 (cstPEMKeyFile) | The certificate store is the name of a PEM-encoded file that contains a private key and an optional certificate. |
| 7 (cstPEMKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a private key and an optional certificate. |
| 8 (cstPublicKeyFile) | The certificate store is the name of a file that contains a PEM- or DER-encoded public key certificate. |
| 9 (cstPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a PEM- or DER-encoded public key certificate. |
| 10 (cstSSHPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains an SSH-style public key. |
| 11 (cstP7BFile) | The certificate store is the name of a PKCS#7 file containing certificates. |
| 12 (cstP7BBlob) | The certificate store is a string (binary) representing a certificate store in PKCS#7 format. |
| 13 (cstSSHPublicKeyFile) | The certificate store is the name of a file that contains an SSH-style public key. |
| 14 (cstPPKFile) | The certificate store is the name of a file that contains a PPK (PuTTY Private Key). |
| 15 (cstPPKBlob) | The certificate store is a string (binary) that contains a PPK (PuTTY Private Key). |
| 16 (cstXMLFile) | The certificate store is the name of a file that contains a certificate in XML format. |
| 17 (cstXMLBlob) | The certificate store is a string that contains a certificate in XML format. |
| 18 (cstJWKFile) | The certificate store is the name of a file that contains a JWK (JSON Web Key). |
| 19 (cstJWKBlob) | The certificate store is a string that contains a JWK (JSON Web Key). |
| 21 (cstBCFKSFile) | The certificate store is the name of a file that contains a BCFKS (Bouncy Castle FIPS Key Store).
NOTE: This store type is only available in Java and .NET. |
| 22 (cstBCFKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in BCFKS (Bouncy Castle FIPS Key Store) format.
NOTE: This store type is only available in Java and .NET. |
| 23 (cstPKCS11) | The certificate is present on a physical security key accessible via a PKCS#11 interface.
To use a security key, create a new Certificate object and pass cstPKCS11 as the StoreType, the full path of the PKCS#11 DLL as the Store, and the PIN as the StorePassword. Code Example. SSH Authentication with Security Key (without CertMgr):
Alternatively, collect the necessary data using the CertMgr component by calling the ListStoreCertificates method after setting the corresponding properties accordingly. The certificate information returned in the CertList event's CertEncoded parameter may be saved for later use. When using a certificate obtained with this approach, pass the previously saved security key information as the Store and set StorePassword to the PIN. Code Example. SSH Authentication with Security Key (with CertMgr):
|
| 99 (cstAuto) | The store type is automatically detected from the input data. This setting may be used with both public and private keys and can detect any of the supported formats automatically. |
SubjectAltNames
string (read-only)
Default:
""
Comma-separated lists of alternative subject names for the certificate.
ThumbprintMD5
string (read-only)
Default:
""
The MD5 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.
ThumbprintSHA1
string (read-only)
Default:
""
The SHA-1 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.
ThumbprintSHA256
string (read-only)
Default:
""
The SHA-256 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.
Usage
string (read-only)
Default:
""
The text description of UsageFlags.
This value will be one or more of the following strings and will be separated by commas:
- Digital Signature
- Non-Repudiation
- Key Encipherment
- Data Encipherment
- Key Agreement
- Certificate Signing
- CRL Signing
- Encipher Only
If the provider is OpenSSL, the value is a comma-separated list of X.509 certificate extension names.
UsageFlags
int (read-only)
Default:
0
The flags that show intended use for the certificate. The value of UsageFlags is a combination of the following flags:
| 0x80 | Digital Signature |
| 0x40 | Non-Repudiation |
| 0x20 | Key Encipherment |
| 0x10 | Data Encipherment |
| 0x08 | Key Agreement |
| 0x04 | Certificate Signing |
| 0x02 | CRL Signing |
| 0x01 | Encipher Only |
Please see the Usage field for a text representation of UsageFlags.
This functionality currently is not available when the provider is OpenSSL.
Version
string (read-only)
Default:
""
The certificate's version number. The possible values are the strings "V1", "V2", and "V3".
Subject
string
Default:
""
The subject of the certificate used for client authentication.
This field will be populated with the full subject of the loaded certificate. When loading a certificate, the subject is used to locate the certificate in the store.
If an exact match is not found, the store is searched for subjects containing the value of the property.
If a match is still not found, the property is set to an empty string, and no certificate is selected.
The special value "*" picks a random certificate in the certificate store.
The certificate subject is a comma-separated list of distinguished name fields and values. For instance, "CN=www.server.com, OU=test, C=US, E=example@email.com". Common fields and their meanings are as follows:
| Field | Meaning |
| CN | Common Name. This is commonly a hostname like www.server.com. |
| O | Organization |
| OU | Organizational Unit |
| L | Locality |
| S | State |
| C | Country |
| E | Email Address |
If a field value contains a comma, it must be quoted.
Encoded
string
Default:
""
The certificate (PEM/Base64 encoded). This field is used to assign a specific certificate. The Store and Subject fields also may be used to specify a certificate.
When Encoded is set, a search is initiated in the current Store for the private key of the certificate. If the key is found, Subject is updated to reflect the full subject of the selected certificate; otherwise, Subject is set to an empty string.
EncodedB
byte []
Default:
""
The certificate (PEM/Base64 encoded). This field is used to assign a specific certificate. The Store and Subject fields also may be used to specify a certificate.
When Encoded is set, a search is initiated in the current Store for the private key of the certificate. If the key is found, Subject is updated to reflect the full subject of the selected certificate; otherwise, Subject is set to an empty string.
Constructors
public Certificate();
Public Certificate()
Creates a instance whose properties can be set.
public Certificate(string certificateFile);
Public Certificate(ByVal CertificateFile As String)
Opens CertificateFile and reads out the contents as an X.509 public key.
public Certificate(byte[] encoded);
Public Certificate(ByVal Encoded As Byte())
Parses Encoded as an X.509 public key.
public Certificate(CertStoreTypes storeType, string store, string storePassword, string subject);
Public Certificate(ByVal StoreType As CertStoreTypes, ByVal Store As String, ByVal StorePassword As String, ByVal Subject As String)
StoreType identifies the type of certificate store to use. See for descriptions of the different certificate stores. Store is a file containing the certificate store. StorePassword is the password used to protect the store.
After the store has been successfully opened, the component will attempt to find the certificate identified by Subject . This can be either a complete or a substring match of the X.509 certificate's subject Distinguished Name (DN). The Subject parameter can also take an MD5, SHA-1, or SHA-256 thumbprint of the certificate to load in a "Thumbprint=value" format.
public Certificate(CertStoreTypes storeType, string store, string storePassword, string subject, string configurationString);
Public Certificate(ByVal StoreType As CertStoreTypes, ByVal Store As String, ByVal StorePassword As String, ByVal Subject As String, ByVal ConfigurationString As String)
StoreType identifies the type of certificate store to use. See for descriptions of the different certificate stores. Store is a file containing the certificate store. StorePassword is the password used to protect the store.
ConfigurationString is a newline-separated list of name-value pairs that may be used to modify the default behavior. Possible values include "PersistPFXKey", which shows whether or not the PFX key is persisted after performing operations with the private key. This correlates to the PKCS12_NO_PERSIST_KEY CryptoAPI option. The default value is True (the key is persisted). "Thumbprint" - an MD5, SHA-1, or SHA-256 thumbprint of the certificate to load. When specified, this value is used to select the certificate in the store. This is applicable to the cstUser , cstMachine , cstPublicKeyFile , and cstPFXFile store types. "UseInternalSecurityAPI" shows whether the platform (default) or the internal security API is used when performing certificate-related operations.
After the store has been successfully opened, the component will attempt to find the certificate identified by Subject . This can be either a complete or a substring match of the X.509 certificate's subject Distinguished Name (DN). The Subject parameter can also take an MD5, SHA-1, or SHA-256 thumbprint of the certificate to load in a "Thumbprint=value" format.
public Certificate(CertStoreTypes storeType, string store, string storePassword, byte[] encoded);
Public Certificate(ByVal StoreType As CertStoreTypes, ByVal Store As String, ByVal StorePassword As String, ByVal Encoded As Byte())
StoreType identifies the type of certificate store to use. See for descriptions of the different certificate stores. Store is a file containing the certificate store. StorePassword is the password used to protect the store.
After the store has been successfully opened, the component will load Encoded as an X.509 certificate and search the opened store for a corresponding private key.
public Certificate(CertStoreTypes storeType, byte[] store, string storePassword, string subject);
Public Certificate(ByVal StoreType As CertStoreTypes, ByVal Store As Byte(), ByVal StorePassword As String, ByVal Subject As String)
StoreType identifies the type of certificate store to use. See for descriptions of the different certificate stores. Store is a byte array containing the certificate data. StorePassword is the password used to protect the store.
After the store has been successfully opened, the component will attempt to find the certificate identified by Subject . This can be either a complete or a substring match of the X.509 certificate's subject Distinguished Name (DN). The Subject parameter can also take an MD5, SHA-1, or SHA-256 thumbprint of the certificate to load in a "Thumbprint=value" format.
public Certificate(CertStoreTypes storeType, byte[] store, string storePassword, string subject, string configurationString);
Public Certificate(ByVal StoreType As CertStoreTypes, ByVal Store As Byte(), ByVal StorePassword As String, ByVal Subject As String, ByVal ConfigurationString As String)
StoreType identifies the type of certificate store to use. See for descriptions of the different certificate stores. Store is a byte array containing the certificate data. StorePassword is the password used to protect the store.
After the store has been successfully opened, the component will attempt to find the certificate identified by Subject . This can be either a complete or a substring match of the X.509 certificate's subject Distinguished Name (DN). The Subject parameter can also take an MD5, SHA-1, or SHA-256 thumbprint of the certificate to load in a "Thumbprint=value" format.
public Certificate(CertStoreTypes storeType, byte[] store, string storePassword, byte[] encoded);
Public Certificate(ByVal StoreType As CertStoreTypes, ByVal Store As Byte(), ByVal StorePassword As String, ByVal Encoded As Byte())
StoreType identifies the type of certificate store to use. See for descriptions of the different certificate stores. Store is a byte array containing the certificate data. StorePassword is the password used to protect the store.
After the store has been successfully opened, the component will load Encoded as an X.509 certificate and search the opened store for a corresponding private key.
FTPConnection Type
This is a client currently connected to the server.
Remarks
This type represents a client connection to the server.
See the Connections property for more information.
- ClientAddress
- ClientPort
- CurrentDirectory
- CurrentFileName
- FileData
- Id
- Idle
- LastCommand
- RootDir
- Timeout
- TransferMode
- UserName
Fields
ClientAddress
string (read-only)
Default:
""
This field contains the IP address of the connected client.
This field is read only.
ClientPort
int (read-only)
Default:
0
This field contains the port of the connected client.
This field is read only.
CurrentDirectory
string (read-only)
Default:
""
This field contains the current directory of the connected client.
This field is read only.
CurrentFileName
string (read-only)
Default:
""
This field contains the current filename of the connected client.
This field is read only.
FileData
string
Default:
""
This field contains the file data when not using a local file or stream. This field may hold file data to be sent in response to a download request, or it may be populated with file data received from the client when uploading.
From within the FileDownload event set FileData to the content of the file to be sent back.
From within the FileUpload event set the LocalFile parameter to an empty string to indicate that the file should be saved in the FileData field instead of written to disk. When EndTransfer fires the FileData field will contain the upload file data.
FileDataB
byte []
Default:
""
This field contains the file data when not using a local file or stream. This field may hold file data to be sent in response to a download request, or it may be populated with file data received from the client when uploading.
From within the FileDownload event set FileData to the content of the file to be sent back.
From within the FileUpload event set the LocalFile parameter to an empty string to indicate that the file should be saved in the FileData field instead of written to disk. When EndTransfer fires the FileData field will contain the upload file data.
Id
string (read-only)
Default:
""
This field contains the Id of the connected client.
This field is read only.
Idle
bool (read-only)
Default:
False
This field says whether or not the connected client is idle.
This field is read only.
LastCommand
string (read-only)
Default:
""
This field contains the last received FTP command for this connection.
This field is read only.
RootDir
string (read-only)
Default:
""
This field contains the local root directory of the connected client.
This field is read only.
Timeout
int (read-only)
Default:
0
This field contains the timeout period for the connected client.
This field is read only.
TransferMode
int (read-only)
Default:
0
This field includes the transfer mode (ASCII or binary). If the value is 0 (default), the initial server mode will be used. The valid options for the TransferMode property are as follows:
| tmDefault (0) | The initial mode of the FTP server is taken. No change. |
| tmASCII (1) | Files are transferred in ASCII mode (sends a TYPE A command). |
| tmBinary (2) | Files are transferred in binary mode (sends a TYPE I command). |
UserName
string (read-only)
Default:
""
This field contains the username for the connected client.
This field is read only.
Constructors
public FTPConnection();
Public FTPConnection()
FTPUser Type
This is a user who is authorized to connect to the server.
Remarks
This type represents a user with which a client may log into the server. It contains the user's credentials, home directory, and permissions.
See the AddUser method and the Users property for more information.
Fields
ACL
int (read-only)
Default:
0xFFFF
This field contains the access policy for this user.
- 0x0001: ACL_DIR_CREATE
- 0x0002: ACL_DIR_REMOVE
- 0x0100: ACL_FILE_UPLOAD
- 0x0200: ACL_FILE_DELETE
- 0x0400: ACL_FILE_RENAME
- 0xFFFF: ACL_ALL
This field is read-only.
Connected
bool (read-only)
Default:
False
This field notes whether any connected sessions are present for this user.
This field is read-only.
HomeDir
string (read-only)
Default:
""
This field contains the HomeDir is the directory that will be the initial working directory for the user upon login. To use the same location as the RootDir, set it to an empty string or /. Otherwise, this value must be a virtual path relative to RootDir (or DefaultRootDir if applicable). Users may navigate up from their HomeDir as long as they do not navigate above their RootDir, which they are not able to leave. An example of the meanings of the two values follows:
| RootDir | HomeDir | Full local home path |
| C:/FTPServer | /Users/Me | C:/FTPServer/Users/Me |
This field is read-only.
Name
string (read-only)
Default:
""
This field contains the name for this user.
This field is read-only.
Password
string (read-only)
Default:
""
This field contains the password for this user.
This field is read-only.
RootDir
string (read-only)
Default:
""
This field contains the local root directory for this user.
This field is read-only.
Constructors
Config Settings (FTPServer Component)
The component accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, access to these internal properties is provided through the Config method.FTPServer Config Settings
The default value is True.
NOTE: This is applicable only to incoming SSL and DI connections. This should be set only if there is a specific reason to do so.
Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the component is activated, the DefaultDIInBufferSize reverts to its defined size. The same happens if you attempt to make it too large or too small.
Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the component is activated the DefaultDIOutBufferSize reverts to its defined size. The same happens if you attempt to make it too large or too small.
| Recent Time | Apr 23 19:39 |
| Older Time | Apr 22 2021 |
The default value is 30 days.
NOTE: System TCP/IP stack implementations are not required to support SO_KEEPALIVE.
This property is shared among incoming connections. When the property is set, the corresponding value is set for incoming connections as they are accepted. Existing connections are not modified.
In the case that Linger is True (default), the system will attempt to send pending data for a connection until the default IP timeout expires.
The default behavior might result in a long delay in closing the connection. Although the component returns control immediately, the system could hold system resources until all pending data are sent (even after your application closes).
Setting this property to False forces an immediate disconnection. If you know that the other side has received all the data you sent (e.g., by a client acknowledgment), setting this property to False might be the appropriate course of action.
TCPServer Config Settings
When a client connects, the client's address is checked against the list defined here. If there is no match, the ConnectionRequest event fires with an Accept value set to false. If no action is taken within the ConnectionRequest event, the client will be disconnected.
When a client connects, the client's address is checked against the list defined here. If there is a match, the ConnectionRequest event fires with an Accept value set to false. If no action is taken within the ConnectionRequest event, the client will not be connected.
NOTE: This is applicable only to incoming SSL connections. This should be set only if there is a specific reason to do so.
Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the component is activated, the InBufferSize reverts to its defined size. The same thing will happen if you attempt to make it too large or too small.
InBufferSize is shared among incoming connections. When the setting is set, the corresponding value is set for incoming connections as they are accepted. Existing connections are not modified.
NOTE: This value is not applicable in macOS.
Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the component is activated the OutBufferSize reverts to its defined size. The same thing will happen if you attempt to make it too large or too small.
OutBufferSize is shared among incoming connections. When the setting is set, the corresponding value is set for incoming connections as they are accepted. Existing connections are not modified.
By default, this configuration setting is set to False.
| 0 | IPv4 Only |
| 1 | IPv6 Only |
| 2 | IPv6 and IPv4 |
SSL Config Settings
The value is formatted as a list of paths separated by semicolons. The component will check for the existence of each file in the order specified. When a file is found, the CA certificates within the file will be loaded and used to determine the validity of server or client certificates.
The default value is as follows:
/etc/ssl/ca-bundle.pem;/etc/pki/tls/certs/ca-bundle.crt;/etc/ssl/certs/ca-certificates.crt;/etc/pki/tls/cacert.pem
When enabled, SSL packet logs are output using the SSLStatus event, which will fire each time an SSL packet is sent or received.
Enabling this configuration setting has no effect if SSLProvider is set to Platform.
If set to True, the component will reuse the context if and only if the following criteria are met:
- The target host name is the same.
- The system cache entry has not expired (default timeout is 10 hours).
- The application process that calls the function is the same.
- The logon session is the same.
- The instance of the component is the same.
-----BEGIN CERTIFICATE----- MIIEKzCCAxOgAwIBAgIRANTET4LIkxdH6P+CFIiHvTowDQYJKoZIhvcNAQELBQAw ... Intermediate Cert ... eWHV5OW1K53o/atv59sOiW5K3crjFhsBOd5Q+cJJnU+SWinPKtANXMht+EDvYY2w F0I1XhM+pKj7FjDr+XNj -----END CERTIFICATE----- \r \n -----BEGIN CERTIFICATE----- MIIEFjCCAv6gAwIBAgIQetu1SMxpnENAnnOz1P+PtTANBgkqhkiG9w0BAQUFADBp ... Root Cert ... d8q23djXZbVYiIfE9ebr4g3152BlVCHZ2GyPdjhIuLeH21VbT/dyEHHA -----END CERTIFICATE-----
When set to 0 (default), the CRL check will not be performed by the component. When set to 1, it will attempt to perform the CRL check, but it will continue without an error if the server's certificate does not support CRL. When set to 2, it will perform the CRL check and will throw an error if CRL is not supported.
This configuration setting is supported only in the Java, C#, and C++ editions. In the C++ edition, it is supported only on Windows operating systems.
When set to 0 (default), the component will not perform an OCSP check. When set to 1, it will attempt to perform the OCSP check, but it will continue without an error if the server's certificate does not support OCSP. When set to 2, it will perform the OCSP check and will throw an error if OCSP is not supported.
This configuration setting is supported only in the Java, C#, and C++ editions. In the C++ edition, it is supported only on Windows operating systems.
NOTE: This configuration setting contains the minimum cipher strength requested from the security library. The actual cipher strength used for the connection is shown by the SSLStatus event.
Use this configuration setting with caution. Requesting a lower cipher strength than necessary could potentially cause serious security vulnerabilities in your application.
When the provider is OpenSSL, SSLCipherStrength is currently not supported. This functionality is instead made available through the OpenSSLCipherList configuration setting.
The value of this configuration setting is a newline-separated (CR/LF) list of certificates. For instance:
-----BEGIN CERTIFICATE----- MIIEKzCCAxOgAwIBAgIRANTET4LIkxdH6P+CFIiHvTowDQYJKoZIhvcNAQELBQAw ... Intermediate Cert ... eWHV5OW1K53o/atv59sOiW5K3crjFhsBOd5Q+cJJnU+SWinPKtANXMht+EDvYY2w F0I1XhM+pKj7FjDr+XNj -----END CERTIFICATE----- \r \n -----BEGIN CERTIFICATE----- MIIEFjCCAv6gAwIBAgIQetu1SMxpnENAnnOz1P+PtTANBgkqhkiG9w0BAQUFADBp ... Root Cert ... d8q23djXZbVYiIfE9ebr4g3152BlVCHZ2GyPdjhIuLeH21VbT/dyEHHA -----END CERTIFICATE-----
By default, the enabled cipher suites will include all available ciphers ("*").
The special value "*" means that the component will pick all of the supported cipher suites. If SSLEnabledCipherSuites is set to any other value, only the specified cipher suites will be considered.
Multiple cipher suites are separated by semicolons.
Example values when SSLProvider is set to Platform include the following:
obj.config("SSLEnabledCipherSuites=*");
obj.config("SSLEnabledCipherSuites=CALG_AES_256");
obj.config("SSLEnabledCipherSuites=CALG_AES_256;CALG_3DES");
Possible values when SSLProvider is set to Platform include the following:
- CALG_3DES
- CALG_3DES_112
- CALG_AES
- CALG_AES_128
- CALG_AES_192
- CALG_AES_256
- CALG_AGREEDKEY_ANY
- CALG_CYLINK_MEK
- CALG_DES
- CALG_DESX
- CALG_DH_EPHEM
- CALG_DH_SF
- CALG_DSS_SIGN
- CALG_ECDH
- CALG_ECDH_EPHEM
- CALG_ECDSA
- CALG_ECMQV
- CALG_HASH_REPLACE_OWF
- CALG_HUGHES_MD5
- CALG_HMAC
- CALG_KEA_KEYX
- CALG_MAC
- CALG_MD2
- CALG_MD4
- CALG_MD5
- CALG_NO_SIGN
- CALG_OID_INFO_CNG_ONLY
- CALG_OID_INFO_PARAMETERS
- CALG_PCT1_MASTER
- CALG_RC2
- CALG_RC4
- CALG_RC5
- CALG_RSA_KEYX
- CALG_RSA_SIGN
- CALG_SCHANNEL_ENC_KEY
- CALG_SCHANNEL_MAC_KEY
- CALG_SCHANNEL_MASTER_HASH
- CALG_SEAL
- CALG_SHA
- CALG_SHA1
- CALG_SHA_256
- CALG_SHA_384
- CALG_SHA_512
- CALG_SKIPJACK
- CALG_SSL2_MASTER
- CALG_SSL3_MASTER
- CALG_SSL3_SHAMD5
- CALG_TEK
- CALG_TLS1_MASTER
- CALG_TLS1PRF
obj.config("SSLEnabledCipherSuites=*");
obj.config("SSLEnabledCipherSuites=TLS_DHE_DSS_WITH_AES_128_CBC_SHA");
obj.config("SSLEnabledCipherSuites=TLS_DHE_DSS_WITH_AES_128_CBC_SHA;TLS_ECDH_RSA_WITH_AES_128_CBC_SHA");
Possible values when SSLProvider is set to Internal include the following:
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
- TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
- TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_RSA_WITH_AES_256_GCM_SHA384
- TLS_RSA_WITH_AES_128_GCM_SHA256
- TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
- TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
- TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
- TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
- TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
- TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
- TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
- TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
- TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
- TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
- TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
- TLS_RSA_WITH_AES_256_CBC_SHA256
- TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
- TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
- TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
- TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
- TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
- TLS_RSA_WITH_AES_128_CBC_SHA256
- TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
- TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
- TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
- TLS_RSA_WITH_AES_256_CBC_SHA
- TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
- TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
- TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
- TLS_DHE_RSA_WITH_AES_256_CBC_SHA
- TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
- TLS_DHE_DSS_WITH_AES_256_CBC_SHA
- TLS_RSA_WITH_AES_128_CBC_SHA
- TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
- TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
- TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
- TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
- TLS_DHE_RSA_WITH_AES_128_CBC_SHA
- TLS_DHE_DSS_WITH_AES_128_CBC_SHA
- TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
- TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
- TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
- TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
- TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
- TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
- TLS_RSA_WITH_3DES_EDE_CBC_SHA
- TLS_RSA_WITH_DES_CBC_SHA
- TLS_DHE_RSA_WITH_DES_CBC_SHA
- TLS_DHE_DSS_WITH_DES_CBC_SHA
- TLS_RSA_WITH_RC4_128_MD5
- TLS_RSA_WITH_RC4_128_SHA
When TLS 1.3 is negotiated (see SSLEnabledProtocols), only the following cipher suites are supported:
- TLS_AES_256_GCM_SHA384
- TLS_CHACHA20_POLY1305_SHA256
- TLS_AES_128_GCM_SHA256
SSLEnabledCipherSuites is used together with SSLCipherStrength.
Not all supported protocols are enabled by default. The default value is 4032 for client components, and 3072 for server components. To specify a combination of enabled protocol versions set this config to the binary OR of one or more of the following values:
| TLS1.3 | 12288 (Hex 3000) |
| TLS1.2 | 3072 (Hex C00) (Default - Client and Server) |
| TLS1.1 | 768 (Hex 300) (Default - Client) |
| TLS1 | 192 (Hex C0) (Default - Client) |
| SSL3 | 48 (Hex 30) |
| SSL2 | 12 (Hex 0C) |
Note that only TLS 1.2 is enabled for server components that accept incoming connections. This adheres to industry standards to ensure a secure connection. Client components enable TLS 1.0, TLS 1.1, and TLS 1.2 by default and will negotiate the highest mutually supported version when connecting to a server, which should be TLS 1.2 in most cases.
SSLEnabledProtocols: Transport Layer Security (TLS) 1.3 Notes:
By default when TLS 1.3 is enabled, the component will first try to use the platform TLS 1.3 implementation when the SSLProvider is set to Automatic for all editions. If the platform TLS 1.3 implementation is not available, the internal implementation will be used.
In editions that are designed to run on Windows, SSLProvider can be set to Platform to use the platform implementation instead of the internal implementation. When configured in this manner, please note that the platform provider is supported only on Windows 11/Windows Server 2022 and up. The default internal provider is available on all platforms and is not restricted to any specific OS version.
If set to 1 (Platform provider), please be aware of the following notes:
- The platform provider is available only on Windows 11/Windows Server 2022 and up.
- SSLEnabledCipherSuites and other similar SSL configuration settings are not supported.
- If SSLEnabledProtocols includes both TLS 1.3 and TLS 1.2, these restrictions are still applicable even if TLS 1.2 is negotiated. Enabling TLS 1.3 with the platform provider changes the implementation used for all TLS versions.
SSLEnabledProtocols: SSL2 and SSL3 Notes:
SSL 2.0 and 3.0 are not supported by the component when the SSLProvider is set to internal. To use SSL 2.0 or SSL 3.0, the platform security API must have the protocols enabled and SSLProvider needs to be set to platform.
This configuration setting is applicable only when SSLProvider is set to Internal.
If set to True, all certificates returned by the server will be present in the Encoded parameter of the SSLServerAuthentication event. This includes the leaf certificate, any intermediate certificate, and the root certificate.
Note: When SSLProvider is set to Internal this value is automatically set to true. This is needed for proper validation when using the internal provider.
When set, the component will save the session secrets in the same format as the SSLKEYLOGFILE environment variable functionality used by most major browsers and tools, such as Chrome, Firefox, and cURL. This file can then be used in tools such as Wireshark to decrypt TLS traffic for debugging purposes. When writing to this file, the component will only append, it will not overwrite previous values.
NOTE: This configuration setting is applicable only when SSLProvider is set to Internal.
NOTE: For server components (e.g., TCPServer), this is a per-connection configuration setting accessed by passing the ConnectionId. For example:
server.Config("SSLNegotiatedCipher[connId]");
NOTE: For server components (e.g., TCPServer), this is a per-connection configuration setting accessed by passing the ConnectionId. For example:
server.Config("SSLNegotiatedCipherStrength[connId]");
NOTE: For server components (e.g., TCPServer), this is a per-connection configuration setting accessed by passing the ConnectionId. For example:
server.Config("SSLNegotiatedCipherSuite[connId]");
NOTE: For server components (e.g., TCPServer), this is a per-connection configuration setting accessed by passing the ConnectionId. For example:
server.Config("SSLNegotiatedKeyExchange[connId]");
NOTE: For server components (e.g., TCPServer), this is a per-connection configuration setting accessed by passing the ConnectionId. For example:
server.Config("SSLNegotiatedKeyExchangeStrength[connId]");
NOTE: For server components (e.g., TCPServer), this is a per-connection configuration setting accessed by passing the ConnectionId. For example:
server.Config("SSLNegotiatedVersion[connId]");
| 0x00000001 | Ignore time validity status of certificate. |
| 0x00000002 | Ignore time validity status of CTL. |
| 0x00000004 | Ignore non-nested certificate times. |
| 0x00000010 | Allow unknown certificate authority. |
| 0x00000020 | Ignore wrong certificate usage. |
| 0x00000100 | Ignore unknown certificate revocation status. |
| 0x00000200 | Ignore unknown CTL signer revocation status. |
| 0x00000400 | Ignore unknown certificate authority revocation status. |
| 0x00000800 | Ignore unknown root revocation status. |
| 0x00008000 | Allow test root certificate. |
| 0x00004000 | Trust test root certificate. |
| 0x80000000 | Ignore non-matching CN (certificate CN non-matching server name). |
This functionality is currently not available in Java or when the provider is OpenSSL.
The value of this configuration setting is a newline-separated (CR/LF) list of certificates. For instance:
-----BEGIN CERTIFICATE----- MIIEKzCCAxOgAwIBAgIRANTET4LIkxdH6P+CFIiHvTowDQYJKoZIhvcNAQELBQAw ... Intermediate Cert... eWHV5OW1K53o/atv59sOiW5K3crjFhsBOd5Q+cJJnU+SWinPKtANXMht+EDvYY2w F0I1XhM+pKj7FjDr+XNj -----END CERTIFICATE----- \r \n -----BEGIN CERTIFICATE----- MIIEFjCCAv6gAwIBAgIQetu1SMxpnENAnnOz1P+PtTANBgkqhkiG9w0BAQUFADBp ... Root Cert... d8q23djXZbVYiIfE9ebr4g3152BlVCHZ2GyPdjhIuLeH21VbT/dyEHHA -----END CERTIFICATE-----
When specified the component will verify that the server certificate signature algorithm is among the values specified in this configuration setting. If the server certificate signature algorithm is unsupported, the component throws an exception.
The format of this value is a comma-separated list of hash-signature combinations. For instance:
component.SSLProvider = TCPClientSSLProviders.sslpInternal;
component.Config("SSLEnabledProtocols=3072"); //TLS 1.2
component.Config("TLS12SignatureAlgorithms=sha256-rsa,sha256-dsa,sha1-rsa,sha1-dsa");
The default value for this configuration setting is sha512-ecdsa,sha512-rsa,sha512-dsa,sha384-ecdsa,sha384-rsa,sha384-dsa,sha256-ecdsa,sha256-rsa,sha256-dsa,sha224-ecdsa,sha224-rsa,sha224-dsa,sha1-ecdsa,sha1-rsa,sha1-dsa.
To not restrict the server's certificate signature algorithm, specify an empty string as the value for this configuration setting, which will cause the signature_algorithms TLS 1.2 extension to not be sent.
The default value is ecdhe_secp256r1,ecdhe_secp384r1,ecdhe_secp521r1.
When using TLS 1.2 and SSLProvider is set to Internal, the values refer to the supported groups for ECC. The following values are supported:
- "ecdhe_secp256r1" (default)
- "ecdhe_secp384r1" (default)
- "ecdhe_secp521r1" (default)
The default value is set to balance common supported groups and the computational resources required to generate key shares. As a result, only some groups are included by default in this configuration setting.
NOTE: All supported groups can always be used during the handshake even if not listed here, but if a group is used that is not present in this list, it will incur an additional roundtrip and time to generate the key share for that group.
In most cases, this configuration setting does not need to be modified. This should be modified only if there is a specific reason to do so.
The default value is ecdhe_x25519,ecdhe_secp256r1,ecdhe_secp384r1,ffdhe_2048,ffdhe_3072
The values are ordered from most preferred to least preferred. The following values are supported:
- "ecdhe_x25519" (default)
- "ecdhe_x448"
- "ecdhe_secp256r1" (default)
- "ecdhe_secp384r1" (default)
- "ecdhe_secp521r1"
- "ffdhe_2048" (default)
- "ffdhe_3072" (default)
- "ffdhe_4096"
- "ffdhe_6144"
- "ffdhe_8192"
- "ed25519" (default)
- "ed448" (default)
- "ecdsa_secp256r1_sha256" (default)
- "ecdsa_secp384r1_sha384" (default)
- "ecdsa_secp521r1_sha512" (default)
- "rsa_pkcs1_sha256" (default)
- "rsa_pkcs1_sha384" (default)
- "rsa_pkcs1_sha512" (default)
- "rsa_pss_sha256" (default)
- "rsa_pss_sha384" (default)
- "rsa_pss_sha512" (default)
The default value is ecdhe_x25519,ecdhe_x448,ecdhe_secp256r1,ecdhe_secp384r1,ecdhe_secp521r1,ffdhe_2048,ffdhe_3072,ffdhe_4096,ffdhe_6144,ffdhe_8192,mlkem_512,mlkem_768,mlkem_1024,x25519_mlkem_768,secp256r1_mlkem_768
The values are ordered from most preferred to least preferred. The following values are supported:
- "ecdhe_x25519" (default)
- "ecdhe_x448" (default)
- "ecdhe_secp256r1" (default)
- "ecdhe_secp384r1" (default)
- "ecdhe_secp521r1" (default)
- "ffdhe_2048" (default)
- "ffdhe_3072" (default)
- "ffdhe_4096" (default)
- "ffdhe_6144" (default)
- "ffdhe_8192" (default)
- "mlkem_512" (default)
- "mlkem_768" (default)
- "mlkem_1024" (default)
- "x25519_mlkem_768" (default)
- "secp256r1_mlkem_768" (default)
Post-quantum algorithms (mlkem_512,mlkem_768,mlkem_1024,x25519_mlkem_768,secp256r1_mlkem_768) in our components rely on the operating system's underlying cryptographic primitives. The following platforms are currently supported:
- Windows Server 2025
- Windows 11 24H2
- Windows 11 25H2
Trappable Errors (FTPServer Component)
FTPServer Errors
| 1201 |
TCPServer Errors
| 100 | You cannot change the RemotePort at this time. A connection is in progress. |
| 101 | You cannot change the RemoteHost at this time. A connection is in progress. |
| 102 | The RemoteHost address is invalid (0.0.0.0). |
| 104 | TCPServer is already listening. |
| 106 | Cannot change LocalPort when TCPServer is listening. |
| 107 | Cannot change LocalHost when TCPServer is listening. |
| 108 | Cannot change MaxConnections when TCPServer is listening. |
| 112 | You cannot change MaxLineLength at this time. A connection is in progress. |
| 116 | RemotePort cannot be zero. Please specify a valid service port number. |
| 126 | Invalid ConnectionId. |
| 135 | Operation would block. |
TCP/IP Errors
| 10004 | [10004] Interrupted system call. |
| 10009 | [10009] Bad file number. |
| 10013 | [10013] Access denied. |
| 10014 | [10014] Bad address. |
| 10022 | [10022] Invalid argument. |
| 10024 | [10024] Too many open files. |
| 10035 | [10035] Operation would block. |
| 10036 | [10036] Operation now in progress. |
| 10037 | [10037] Operation already in progress. |
| 10038 | [10038] Socket operation on nonsocket. |
| 10039 | [10039] Destination address required. |
| 10040 | [10040] Message is too long. |
| 10041 | [10041] Protocol wrong type for socket. |
| 10042 | [10042] Bad protocol option. |
| 10043 | [10043] Protocol is not supported. |
| 10044 | [10044] Socket type is not supported. |
| 10045 | [10045] Operation is not supported on socket. |
| 10046 | [10046] Protocol family is not supported. |
| 10047 | [10047] Address family is not supported by protocol family. |
| 10048 | [10048] Address already in use. |
| 10049 | [10049] Cannot assign requested address. |
| 10050 | [10050] Network is down. |
| 10051 | [10051] Network is unreachable. |
| 10052 | [10052] Net dropped connection or reset. |
| 10053 | [10053] Software caused connection abort. |
| 10054 | [10054] Connection reset by peer. |
| 10055 | [10055] No buffer space available. |
| 10056 | [10056] Socket is already connected. |
| 10057 | [10057] Socket is not connected. |
| 10058 | [10058] Cannot send after socket shutdown. |
| 10059 | [10059] Too many references, cannot splice. |
| 10060 | [10060] Connection timed out. |
| 10061 | [10061] Connection refused. |
| 10062 | [10062] Too many levels of symbolic links. |
| 10063 | [10063] File name is too long. |
| 10064 | [10064] Host is down. |
| 10065 | [10065] No route to host. |
| 10066 | [10066] Directory is not empty |
| 10067 | [10067] Too many processes. |
| 10068 | [10068] Too many users. |
| 10069 | [10069] Disc Quota Exceeded. |
| 10070 | [10070] Stale NFS file handle. |
| 10071 | [10071] Too many levels of remote in path. |
| 10091 | [10091] Network subsystem is unavailable. |
| 10092 | [10092] WINSOCK DLL Version out of range. |
| 10093 | [10093] Winsock is not loaded yet. |
| 11001 | [11001] Host not found. |
| 11002 | [11002] Nonauthoritative 'Host not found' (try again or check DNS setup). |
| 11003 | [11003] Nonrecoverable errors: FORMERR, REFUSED, NOTIMP. |
| 11004 | [11004] Valid name, no data record (check DNS setup). |