Example: Session ftp download information functions
This example show the use of the ftp session download information functions:
ftp_get_last_download_details_ex
ftp_get_last_handshake_duration_ex
ftp_get_last_transfer_duration_ex
double duration; unsigned long lSize, lDur; int i; FTP pFTP; char * host = "ftp.microsoft.com";
// For user "user" defined on "host"://"host"\\"user" char * user = "ftp://anonymous:email%40notset.com@ftp.microsoft.com/bussys/readme.txt"; // Note double backslash char * pwd = "anonymous"; char * port = "21"; char ftpURL[100]; sprintf(ftpURL, "URL=ftp://%s:%s@%s:%s", user, pwd, host, port); lr_output_message ("%s", ftpURL);
// Logon to node "host" ftp_logon_ex (&pFTP, "LogOn", ftpURL, LAST );
// c:\inetput\ftproot\testFiles
ftp_dir_ex (&pFTP, "T1", "PATH=/testFiles", LAST );
ftp_get_ex (&pFTP, "Get_Small_File", "bussys/readme.txt", LAST );
duration= ftp_get_last_transfer_duration_ex (&pFTP); lr_output_message ("Get_Small_File Transfer took %.3f milliseconds", duration); ftp_get_last_download_details_ex (&pFTP, &lSize, &lDur); lr_output_message ("Get_Small_File Download of %d bytes took %d milliseconds", lSize, lDur); ftp_get_ex (&pFTP, "Get_Large_File", "SOURCE_PATH=bussys/readme.txt", LAST );
duration= ftp_get_last_transfer_duration_ex (&pFTP); lr_output_message ("Get_Large_File Transfer took %.3f milliseconds", duration); ftp_get_last_download_details_ex (&pFTP, &lSize, &lDur); lr_output_message ("Transfer of %d bytes took %d milliseconds", lSize, lDur); duration = ftp_get_last_handshake_duration_ex (&pFTP); lr_output_message ("Handshake took %f milliseconds", duration); ftp_logout_ex (&pFTP);