Home > Language Reference > FTP Functions > FTPConnect


The FTPConnect function starts a connection to a FTP server.


Used to establish a connection to a FTP server before executing other FTP statements.


ret=FTPConnect(<FTP_servername>,<username>,<encrypted_password> [,<FTP_portnumber>])


<FTP_servername>, string, FTP server to connect to.

<username>, string, username to be used when logging to the FTP server. For an anonymous connection, specify the string "Anonymous" as <username> and leave next field <paswword> blank.

<encrypted_password>, string, password to be used when logging to the FTP server. The string is encrypted. To encrypt the password, use either the Insert/Encrypted string menu option in WinTask Editor window or use the FTPConnect wizard (in the Language window, press F4 if the Language window is not displayed, check Show wizard checkbox and double click FTPConnect in the list). If there is no password, <encrypted_password> is an empty string (an empty string is "").

<FTP_portnumber>, optional integer, port number to be used to connect to the FTP server. The default value is 21.

Return value

Ret, optional numeric return value. If the function succeeds connecting to the FTP server within 30 seconds (this default value can be changed using #FTPTimeout), the function returns 0. If the function fails, the return value is a nonzero negative value (see FTP Functions Error Codes).


Before calling any other FTP function, a FTPConnect must be used.

Only one FTP connection can be established. Use FTPDisconnect function to end a FTP connection.

See also



FtpConnect("www.my_site.com","ftp","MX/WH05CZE3H") 'connection to the FTP server (fake credentials!)

FtpConnect("","Anonymous"," ") ' connection to the anonymous FTP server specified by its IP address

www.my_site.com","ftp","MX/WH05CZE3h",35) ' connection to the FTP server www.my_site.com using port 35