CnfFTP
- Last UpdatedOct 29, 2026
- 2 minute read
CnfFTP is a built-in function that configures the FTP settings used by other features in the project that can transfer files, such the FTPGet and FTPPut functions.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
CnfFTP |
FTP |
Synchronous |
No |
Supported |
Supported |
Not supported |
Supported |
Not supported |
Syntax
CnfFTP(strServer,optStrUser,optStrPassword,optNumPassiveMode,optNumPort)
strServer
The host name or IP address of the FTP server.
optStrUser
optStrPassword
The username and password that will be used to log on to the FTP server.
These parameters are optional; if no values are specified, the project will log on anonymously by default (that is, optStrUser is "anonymous" and optStrPassword is "").
optNumPassiveMode
A numeric flag that specifies whether passive mode is enabled. (Passive FTP can be used to bypass some firewall configurations.) This parameter can have the following possible values:
|
Value |
Description |
|---|---|
|
0 |
Passive mode is disabled (default). |
|
1 |
Passive mode is enabled. |
This parameter is optional; if no value is specified, passive mode is disabled by default.
optNumPort
The port number of the FTP server.
This parameter is optional; if no value is specified, port 21 is used by default.
Returned value
This function returns one of the following possible values:
|
Value |
Description |
|---|---|
|
-3 |
Invalid user name. |
|
-2 |
Invalid server name. |
|
-1 |
Invalid number of parameters. |
|
0 |
Success. |
Note: This function does not actually connect to the specified server, so these error codes do not show the quality of the connection. They only show whether the FTP settings have been successfully configured.
Notes
The FTPGet and FTPPut functions used to transfer files require your project's FTP settings to be configured, either by calling this function at least once, or though using the FTP Settings dialog box.
Examples
Configure the FTP settings using passive mode and the default port 21:
CnfFTP("ftp.mycompany.com","admin","12345",1)