Starting an FTP Session

The application establishes an FTP session by calling InternetConnect on a handle created by InternetOpen. InternetConnect needs the server name, FTP port number, user name, password, and service type, which must be set to INTERNET_SERVICE_FTP. For passive FTP semantics, the application must also set the INTERNET_FLAG_PASSIVE flag.

The INTERNET_DEFAULT_FTP_PORT and INTERNET_INVALID_PORT_NUMBER values can be used for the FTP port number. INTERNET_DEFAULT_FTP_PORT uses the default FTP port, but the service type still must be set. INTERNET_INVALID_PORT_NUMBER uses the default value for the indicated service type.

The values for the user name and password can be set to NULL. If both values are set to NULL, InternetConnect uses anonymous for the user name and the user's e-mail address for the password. If only the password is set to NULL, the user name passed to InternetConnect is used for the user name, and an empty string is used for the password. If neither value is NULL, the user name and password given to InternetConnect are used.

See Also

FTP Sessions | Windows Internet Services (WinInet)

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.