FTP Class

Properties   Methods   Events   Configuration Settings   Errors  

The FTP Class can be used to transfer files to and from FTP servers using the FTP Protocol.

Syntax

FTP

Remarks

The FTP Class supports both plaintext and SSL/TLS connections. When connecting over 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 via the Config method.

The FTP Class implements a standard FTP client as specified in RFC 959 and RFC 1579 with the added option of SSL security (RFC 2228) in both the protocol and data channels.

The first step in using the class is specifying the RemoteHost, User and Password. The file to upload to or download from is given by the RemoteFile property. The file to download to or upload from is specified by LocalFile. The current path in the server is specified by the RemotePath property. The Passive property is especially useful if the client is behind a firewall which inhibits incoming connections to higher ports.

If LocalFile is set to something other than an empty string, then files are received in LocalFile, otherwise the data is received through the Transfer event. StartTransfer and EndTransfer are fired at the beginning and end of transmission.

The PITrail event traces the interaction between the client and the server (the FTP Protocol Interface connection).

Directory listings are received through the DirList event.

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

AccountThe user account to login with.
CommandUsed to send additional commands directly to the server.
ConnectedShows whether the class is connected.
DirListCountThe number of records in the DirList arrays.
DirListEntryThis property contains the raw entry as received from the server.
DirListFileNameThis property shows the file name in the last directory listing.
DirListFileSizeThis property shows the file size in the last directory listing.
DirListFileTimeThis property shows the file time in the last directory listing.
DirListIsDirThis property specifies whether entries in the last directory listing are directories.
DirListIsSymlinkThis property indicates whether the entry is a symbolic link.
FileExistsReturns True if the file specified by RemoteFile exists on the remote server.
FileSizeThe size of the file pointed to by RemoteFile .
FileTimeThe last modification time of the file pointed to by RemoteFile .
FirewallAutoDetectThis property tells the class whether or not to automatically detect and use firewall system settings, if available.
FirewallTypeThis property determines the type of firewall to connect through.
FirewallHostThis property contains the name or IP address of firewall (optional).
FirewallPasswordThis property contains a password if authentication is to be used when connecting through the firewall.
FirewallPortThis property contains the TCP port for the firewall Host .
FirewallUserThis property contains a user name if authentication is to be used connecting through a firewall.
IdleThe current status of the class.
LastReplyThe last reply from the server.
LocalFileThe path to a local file for download/upload. If the file exists, it is overwritten.
LocalHostThe name of the local host or user-assigned IP interface through which connections are initiated or accepted.
OverwriteIndicates whether or not the class should overwrite files during transfer.
PassiveControls whether to direct the server into passive mode. Recommended if behind a firewall.
PasswordThe password to log in.
RemoteFileThe name of the remote file for uploading, downloading, etc.
RemoteHostThe domain name or IP address of the FTP server.
RemotePathThe current path in the FTP server.
RemotePortThe port for the FTP service (default is 21).
SSLAcceptServerCertEncodedThe certificate (PEM/base64 encoded).
SSLCertEncodedThe certificate (PEM/base64 encoded).
SSLCertStoreThe name of the certificate store for the client certificate.
SSLCertStorePasswordIf the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
SSLCertStoreTypeThe type of certificate store for this certificate.
SSLCertSubjectThe subject of the certificate used for client authentication.
SSLEnabledWhether TLS/SSL is enabled.
SSLServerCertEncodedThe certificate (PEM/base64 encoded).
SSLStartModeDetermines how the class starts the SSL negotiation.
StartByteThe byte index in RemoteFile and LocalFile from which to start the transmission.
TimeoutA timeout for the class.
TransferModeThe transfer mode (ASCII or Binary). If the value is 0 (default), the initial server mode will be used.
UserThe user identifier to use for login.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

AbortAbort Current Upload/Download.
AppendAppend data from LocalFile to a RemoteFile on an FTP server.
ConfigSets or retrieves a configuration setting.
DeleteFileRemove a file specified by FileName from an FTP server.
DoEventsProcesses events from the internal message queue.
DownloadDownload a RemoteFile from an FTP server.
InterruptInterrupt the current method.
ListDirectoryList the current directory specified by RemotePath on an FTP server.
ListDirectoryLongList extended directory information for RemotePath .
LogoffLogoff from the FTP server by posting a QUIT command.
LogonLogon to the FTP RemoteHost using the current User and Password .
MakeDirectoryCreate a directory on an FTP server.
RemoveDirectoryRemove a directory specified by DirName from an FTP server.
RenameFileChange the name of RemoteFile to NewName .
ResetReset the class.
SetDownloadStreamSets the stream to which the downloaded data from the server will be written.
SetUploadStreamSets the stream from which the class will read data to upload to the server.
StoreUniqueUpload a file with a Unique Name to an FTP server.
UploadUpload a file specified by LocalFile to an FTP server.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

ConnectionStatusFired to indicate changes in connection state.
DirListFired when a directory entry is received.
EndTransferFired when a file completes downloading/uploading.
ErrorInformation about errors during data delivery.
PITrailTraces the commands sent to the server, and the respective replies.
SSLServerAuthenticationFired after the server presents its certificate to the client.
SSLStatusShows the progress of the secure connection.
StartTransferFired when a file starts downloading/uploading.
TransferFired during file download/upload.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

ActiveModeIPAllows the specification of the IP address that the server will connect to for active mode connections.
ActiveModePORTAddressAllows the specification of the PORT address value for active mode connections.
AppendToLocalFileAppend downloaded files to a local file.
ApplyFileMaskLocallyWhether to filter the directory listing locally or on the server.
AutoSelectDataIPAutomatically select the data connection IP.
CalculatePercentDoneEnables or Disables calculating the percent complete for downloads.
CheckTotalEntryWhether to ignore directory listing total lines.
DILingerWhen set to True, DI connections are terminated gracefully.
DILingerTimeTime in seconds to have the DI connection linger.
FileTimeFormatThe format of file time reported by the server.
IgnoreEntriesDirectory entry data to ignore.
MaskSensitiveMasks passwords in logs.
ModeZCompressionLevelUsed to specify the level of compression used.
PortRangeAllows the specification of a port range where the class listens for active mode connections.
PreserveFileTimeAttempts to preserve timestamps when transferring files.
RealTimeUploadEnables real time uploading.
RealTimeUploadAgeLimitThe age limit in seconds when using RealTimeUpload.
ReusePISSLSessionInDIWhether the PI SSL session will be reused for the DI connection.
ReuseSSLSessionInDIWhether the SSL session will be reused for the DI connection.
UseClearChannelAllows for the Clear Command Channel (CCC) command.
UseClearDataChannelAllows for the PROT C command.
UseEPSVAllows extended passive mode.
UseMLSDUses listings for machine processing.
UseMLSTUses single file listing for machine processing.
UseModeZAllows compression to be used when transferring data.
UseOldAUTHSSLAllows use of the 'AUTH SSL' command instead of 'AUTH TLS'.
UseProtWhenImplicitSends the PROT P command to the server.
UseRemoteHostAddressForPassiveInstructs the class to use the address specified by RemoteHost when establishing a data connection.
VirtualHostNameSends the HOST command to the server.
ConnectionTimeoutSets a separate timeout value for establishing a connection.
FirewallAutoDetectTells the class whether or not to automatically detect and use firewall system settings, if available.
FirewallHostName or IP address of firewall (optional).
FirewallPasswordPassword to be used if authentication is to be used when connecting through the firewall.
FirewallPortThe TCP port for the FirewallHost;.
FirewallTypeDetermines the type of firewall to connect through.
FirewallUserA user name if authentication is to be used connecting through a firewall.
KeepAliveIntervalThe retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received.
KeepAliveRetryCountThe number of keep-alive packets to be sent before the remotehost is considered disconnected.
KeepAliveTimeThe inactivity time in milliseconds before a TCP keep-alive packet is sent.
LingerWhen set to True, connections are terminated gracefully.
LingerTimeTime in seconds to have the connection linger.
LocalHostThe name of the local host through which connections are initiated or accepted.
LocalPortThe port in the local host where the class binds.
MaxLineLengthThe maximum amount of data to accumulate when no EOL is found.
MaxTransferRateThe transfer rate limit in bytes per second.
ProxyExceptionsListA semicolon separated list of hosts and IPs to bypass when using a proxy.
TCPKeepAliveDetermines whether or not the keep alive socket option is enabled.
TcpNoDelayWhether or not to delay when sending packets.
UseIPv6Whether to use IPv6.
LogSSLPacketsControls whether SSL packets are logged when using the internal security API.
OpenSSLCADirThe path to a directory containing CA certificates.
OpenSSLCAFileName of the file containing the list of CA's trusted by your application.
OpenSSLCipherListA string that controls the ciphers to be used by SSL.
OpenSSLPrngSeedDataThe data to seed the pseudo random number generator (PRNG).
ReuseSSLSessionDetermines if the SSL session is reused.
SSLCACertFilePathsThe paths to CA certificate files on Unix/Linux.
SSLCACertsA newline separated list of CA certificate to use during SSL client authentication.
SSLCipherStrengthThe minimum cipher strength used for bulk encryption.
SSLEnabledCipherSuitesThe cipher suite to be used in an SSL negotiation.
SSLEnabledProtocolsUsed to enable/disable the supported security protocols.
SSLEnableRenegotiationWhether the renegotiation_info SSL extension is supported.
SSLIncludeCertChainWhether the entire certificate chain is included in the SSLServerAuthentication event.
SSLNegotiatedCipherReturns the negotiated ciphersuite.
SSLNegotiatedCipherStrengthReturns the negotiated ciphersuite strength.
SSLNegotiatedCipherSuiteReturns the negotiated ciphersuite.
SSLNegotiatedKeyExchangeReturns the negotiated key exchange algorithm.
SSLNegotiatedKeyExchangeStrengthReturns the negotiated key exchange algorithm strength.
SSLNegotiatedVersionReturns the negotiated protocol version.
SSLProviderThe name of the security provider to use.
SSLSecurityFlagsFlags that control certificate verification.
SSLServerCACertsA newline separated list of CA certificate to use during SSL server certificate validation.
TLS12SignatureAlgorithmsDefines the allowed TLS 1.2 signature algorithms when UseInternalSecurityAPI is True.
TLS12SupportedGroupsThe supported groups for ECC.
TLS13KeyShareGroupsThe groups for which to pregenerate key shares.
TLS13SignatureAlgorithmsThe allowed certificate signature algorithms.
TLS13SupportedGroupsThe supported groups for (EC)DHE key exchange.
AbsoluteTimeoutDetermines whether timeouts are inactivity timeouts or absolute timeouts.
FirewallDataUsed to send extra data to the firewall.
InBufferSizeThe size in bytes of the incoming queue of the socket.
OutBufferSizeThe size in bytes of the outgoing queue of the socket.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks EDI 2020 C++ Edition - Version 20.0 [Build 8203]