Hi Aaron
Sure I'll e-mail you a direct link.
Here's some code for calculating the download speed of a single download:
Create an ExFTPConnection (or FTPConnection or SecureFTPConnection) and add handlers for the Downloading event (to store the start-time) and the BytesTransferred event (to calculate the download speed).
ExFTPConnection exFTP = new ExFTPConnection();
exFTP.Downloading += new FTPFileTransferEventHandler(exFTP_Downloading);
exFTP.BytesTransferred += new BytesTransferredHandler(exFTP_BytesTransferred);
Store the start-time and store in a field.
void exFTP_Downloading(object sender, FTPFileTransferEventArgs e)
{
downloadStartTime = DateTime.Now;
}
Calculate the download speed and print it to the console.
void exFTP_BytesTransferred(object sender, BytesTransferredEventArgs e)
{
TimeSpan downloadTime = DateTime.Now - downloadStartTime;
float downloadSpeed = ((float)e.ByteCount) / downloadTime.TotalSeconds;
Console.WriteLine("Average download speed = " + downloadSpeed + " bytes per second.");
}
downloadStartTime is a DateTime field of the class.
- Hans (EnterpriseDT)