|
|
|
|
|
- Security error in a secure FTPS connection
FTPConnect (Function) In french: FTPConnecte Connects the current computer to an FTP server (File Transfer Protocol).
ResConnect = FTPConnect("192.54.12.8")
Syntax
<Result> = FTPConnect(<Server> [, <User name> [, <Password> [, <Port number> [, <Type of connection> [, <Connection timeout> [, <Private key> [, <Key password>]]]]]]])
<Result>: Integer - Connection ID,
- 0 during the first connection.
- -1 if an error occurred. The details of the error are returned by ErrorInfo with the errCode or errMessage constant.
If an identification error occurs, ErrorInfo with the errCode constant returns the ftpErrorAuthentication constant.
<Server>: Character string Name of FTP server ("ftp.cdrom.com" for example) or IP address of FTP server ("192.54.12.8" for example). <User name>: Optional character string - Name of user attempting to perform a named connection (user authentication on FTP server). This parameter is given by the administrator of FTP server.
- Empty string ("") to perform an anonymous connection.
<Password>: Optional character string User password: identifies the user on the FTP server. This parameter is given by the administrator of FTP server.This password corresponds to: - the specified <Password> if this parameter is not an empty string (""),
- the email address of the user if <Username> is not specified or it is equal to an empty string (""),
- an empty string ("") if this parameter is not specified and if <Username> does not correspond to an empty string ("").
Note: If the password contains special characters, it may be necessary to convert it to UTF8 using the StringToUTF8 function. <Port number>: Optional integer Number of the port on which the server will be run. This parameter is given by the administrator of FTP server.By default: - for a non-secure connection, this port is port 21.
- for a secure connection in FTPS mode, this port is port 990.
- for a secure connection in FTPES mode, this port is port 21.
- for a secure connection in SFTP mode, this port is port 22.
<Type of connection>: Optional Integer constant Type of connection to perform:
| | ftpActiveMode (or False for compatibility) | Active connection to the FTP server. When transferring files, the client starts the transfer. This type of connection may be refused by some protected FTP servers. | ftpExtendedPassiveMode | Extended passive connection to the FTP server (EPSV mode). When transferring files, the server takes the initiative for the transfer. This type of connection is used to step over some "firewalls". If the server does not support the extended passive mode (the FEAT command is sent to the server to find out the capacity), the connection is crippled in simple passive mode. Limitations: - This mode is not supported when using the Windows "wininet" module (see function FTPConfigure): the connection is made in mode ftpModePassif.
- Constant not available.
| ftpPassiveMode (or True for compatibility) (Default value) | Passive connection to the FTP server (PASV mode). When transferring files, the server takes the initiative for the transfer. This type of connection is used to step over some "firewalls". Note: If the connection to the server is in IPV6, then the connection will be made in extended passive mode (because passive mode does not support IPV6).. | ftpPassiveModeIgnoreIP | Passive connection to the FTP server (PASV mode). When transferring files in passive mode, the server sets the port and IP address for data transfer. With this parameter, only the port is taken into account. The IP address is ignored. This type of connection allows the use of FTP servers that return non-routable IP addresses but are reachable via the connection IP address Limitations: - This mode is not supported when using the Windows "wininet" module (see function FTPConfigure): the connection is made in mode ftpModePassif.
|
<Connection timeout>: Optional integer or optional Duration Number of seconds after which the request for connecting to the FTP server is canceled (20 by default). This timeout applies to all FTP operations performed on this connection. If no response is received from the server during the specified <Connection timeout>, FTPConnect returns -1. Note: This parameter can correspond to: - an integer corresponding to the number of seconds,
- a Duration variable,
- the duration in a readable format (e.g., '1s').
<Private key>: Optional character string <Key password>: Optional ANSI character string
Related Examples:
|
Unit examples (WINDEV): The FTP functions
[ + ] Using the main FTP functions of WINDEV: - Connect to a FTP server - List the files and directories found on the FTP server - Retrieve the files found on the FTP server - Disconnect from a FTP server
|
|
Complete examples (WINDEV): WD FTP File Transfer
[ + ] WD FTP file transfer This example is a full FTP client allowing you to store several FTP servers. Then, you have the ability to perform multi-file transfers from the local computer to the server or from the FTP server to the local computer. To do so, we are using the standard functions of WLanguage (FTPConnect, etc...)
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|