ftp_get_last_download_details_ex

FTP Functions (ftp)

Gets the duration and received byte count of the last ftp_get call in the session.

int ftp_get_last_download_details_ex( FTP *ppFtp, unsigned long * pByteCount, unsigned long * pDuration );

ftp_get_last_download_details_ex gets statistics of the last download in the session. It assigns the total download duration in milliseconds to the long integer variable to which pDuration points. This duration includes the actual transfer time and the connection overhead.

The number of bytes downloaded is assigned to the long integer variable to which pByteCount points.

The ppFtp argument is the address of the pointer to the session identifier.

To get the net transfer time, use ftp_get_last_transfer_duration_ex.

Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure. Note that in many cases, this return value indicates the technical success of the function, and not the result. For example, a function that registers a string to be found in a subsequent step returns LR_PASS to indicate that the registration was successful. This does not indicate that the string was found in the server response.

Parameterization

Standard parameterization is not available for this function.

  Example

This example shows the use of the ftp session download information functions:

Copy code
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);