Example: ftp_logon_ex

In Example 1, the ftp_logon_ex function logs on to the FTP server ftp.merc-int.com for the session ftp.

In Example 2, the logon is performed on a windows server where the user is defined on the server.

Example 1

// Logon to the FTP server
ftp_logon_ex(&ftp,"FTP",
                    "URL=ftp://user:pwd@ftp.merc-int.com",                     "LocalAddr=ca_server:21",                     "ClientCert=/ca/pem/",                     "ClientKey=/ca/pem/key/",                     "ClientPassword=@3#$8800cvd",                     "CertificateAuthority=/ca/",                     LAST ); . . . // Logout from the FTP server     ftp_logout_ex(&ftp);

Example 2

In the following example, the ftp_logon_ex function logs on to the windows based server mansfield, where the user is defined locally on the server. Note the syntax for user "fanny", password "price", defined on server "mansfield.

    The user is mansfield\fanny. The URL is "URL=ftp://mansfield\\fanny:price@mansfield"

    The double backslash is required.

{
unsigned long *ftp_session=NULL;
// Log on to server "mansfield". 
ftp_logon_ex(&ftp_session,"FtpLogon",
    "URL=ftp://mansfield\\fanny:price@mansfield",LAST );
ftp_logout_ex(&ftp_session);
return 0;
}

Example 3

In this example, ftp_logon_ex connects to the default FTP port of ftp_server and enables SSL on the control connection.

ftp_logon_ex(ftp1, "FTP logon transaction", "URL=ftps://user:password@ftp_server", "AUTH TLS", LAST );