473,246 Members | 1,296 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 software developers and data experts.

Finding Download Speed using DownloadFileAsync

Hi,

I know there isn't a specific event property for the download speed, but can
anyone tell me how to find it? I'm not sure how to write the code.

Thanks,
Jason
Jul 17 '08 #1
2 5786
On Thu, 17 Jul 2008 08:51:02 -0700, greatbarrier86
<gr************@discussions.microsoft.comwrote:
I know there isn't a specific event property for the download speed, but
can
anyone tell me how to find it? I'm not sure how to write the code.
Using WebClient.DownloadFileAsync(), I don't think there's a good way to
do it. AFAIK, the WebClient class doesn't expose the information, nor
does it expose enough information for you to calculate it.

If you do the download yourself with an i/o class like NetworkStream, you
can explicitly read the data is small chunks (e.g. 8K at a time) and then
periodically calculate the download speed yourself (data read divided by
time is speed).

Pete
Jul 17 '08 #2
Before calling the function you need to do two things:
1) Either the record the time or create and start a Stopwatch in a class
level variable (function level is you use an anonymous function for part 2)
2) Add an event handler to the DownloadProgressChanged event.
3) When the event is fired, the DownloadProgressChangedEventArgs has
BytesReceived property, you can then see either
a) how much has been downloaded and the elasped time since the last time the
event was fired for a current rate, or how much since the start of downlaod
to get an average rate for the file (less helpful to a watching user of
course).

The DownloadProgressChangedEventArgs also has the TotalBytesToReceive
property which you can use along with the speed to work out the time
remaining.

Hope this helps

--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"greatbarrier86" wrote:
Hi,

I know there isn't a specific event property for the download speed, but can
anyone tell me how to find it? I'm not sure how to write the code.

Thanks,
Jason
Jul 18 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Matthew Sims | last post by:
Is it possible to force a download without using the readfile function? My website setup consists of my server that serves the web pages plus a high-speed file server elsewhere on the internet...
4
by: D. Alvarado | last post by:
Hello, I would like to design a page that measures the user's download connection. Does anyone have an example link or script that might aid me in this task? Thanks, - Dave
12
by: chipgraphics | last post by:
:confused::confused: I have been on the quest to find a php script that can serve files for downloads and limit the speed at which the file is transfered to the user. I want a faster download...
5
by: gjzusenet | last post by:
Hello. Though Python supports threading, I think it is limited to python code - as soon as you issue a command that uses an external (C?) module, all of your python threads hang until this command...
6
by: Giovanni | last post by:
Hi Guys, Really strange problem I am experiencing... I have setup a virtual directory with Read Only permissions on an ISA/IIS server (SBS 2003). In that virt. dir., I placed 1 file...
1
by: bigpoppa | last post by:
Hey, I need a script that will limit download speed and I want it integrated into the script I am using below. The script below forces downloads and hides url paths and logs stastics of downloads and...
4
by: halimunan | last post by:
Hello all, I have a question, how do i measure the download/upload speed... as if download rate, upload rate or kbps transfer rate. i want to do my own windows application using C# to measure the...
6
by: sajjadlove | last post by:
Hi there i use from following code for download a file from ftp server but it doesn't work...... what's that problem ?!...... //FTP Class public event...
4
by: nestle | last post by:
I have DSL with a download speed of 32MB/s and an upload speed of 8MB/s(according to my ISP), and I am using a router. My upload speed is always between 8MB/s and 9MB/s(which is above the max upload...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.