ftp_get_last_download_details

FTP Functions (ftp)

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

int ftp_get_last_download_details( unsigned long * pByteCount, unsigned long *pDuration );

ftp_get_last_download_details gets statistics of the last download. 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.

To get the net transfer time, use ftp_get_last_transfer_duration.

Return Values

If this function succeeds, it returns LR_PASS. Otherwise, it returns LR_FAIL.

Parameterization

Parameterization is not applicable to this function.

  Example

This example shows the use of the download information functions.

Copy code
double duration;
double duration; 
    unsigned long lSize, lDur; 
    int i; 
    char * host = "ftp.microsoft.com"; 
    // For user "charlotte" defined on "myHost"://"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 ("Transaction1", ftpURL, 
            LAST ); 
    // c:\inetput\ftproot\testFiles        
    ftp_dir ("T1", "PATH=/testFiles", 
            LAST ); 
    ftp_get ("Get_Small_File", "bussys/readme.txt",
            LAST ); 
    duration= ftp_get_last_transfer_duration(); 
    lr_output_message ("Get_Small_File Transfer took %.3f milliseconds", duration); 
    ftp_get_last_download_details (&lSize, &lDur); 
    lr_output_message ("Get_Small_File Download of %d bytes took %d milliseconds", lSize, lDur); 
    ftp_get ("Get_Large_File", "SOURCE_PATH=bussys/readme.txt",
            LAST ); 
    duration= ftp_get_last_transfer_duration(); 
    lr_output_message ("Get_Large_File Transfer took %.3f milliseconds", duration); 
    ftp_get_last_download_details (&lSize, &lDur); 
    lr_output_message ("Transfer of %d bytes took %d milliseconds", lSize, lDur); 
    duration = ftp_get_last_handshake_duration(); 
    lr_output_message ("Handshake took %f milliseconds", duration); 
    ftp_logout();