Click here to Skip to main content
15,888,008 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I need to calculate download and upload speed of internet which we are using.
But i don't want to upload or download the file to find out that.

For example , "http://beta.speedtest.net/"[^]

Like this, need to get the download and upload speed in C#.

Suggest on this.

What I have tried:

I tried How to calculate network bandwidth speed in c# - Mohamed Mansour[^] with this link but its giving difference between real speed.

Also tried with using Ping Class How to Use Ping in C#[^] . By this we can find out Status,Address,Roundtrip but dont know to find upload and download speed.
Posted
Updated 12-Apr-17 23:56pm
Comments
Richard MacCutchan 13-Apr-17 4:21am    
The only way to get a valid calculation is by downloading and uploading some data.

Ping does not measure throughput and anything that you do using minimal amounts of data (e.g. you might consider using HTTP Get/Post to estimate downlink/uplink throughput if you can time those transactions and know the transfer byte counts). However such an approach would be totally flawed - don't waste your time on this.

As Richard MaxCutchan has said you have to transfer data, and if the estimate is to be of any use you're going to need to transfer a "reasonable" amount. How much is reasonable? Well, the more data you transfer the better you average over the variable throughput that's achieved on ALL packet data networks (including the internet). This is why you'll see the throughput estimates on sites like speedtest.net fluctuate wildly at the start of the test, then stabilise to a longer-term average.

Remember also that there's latency to consider. That is, a delay between your request to trigger an upload/download and the transfer actually beginning. If your test uses large byte counts then you may be able to ignore that time delay, otherwise you need to carefully eliminate it from the throughput time.

There is a very good tool called iPerf (and a companion tool jPerf which is iPerf with a GUI) that can be used for throughput measurement. iPerf allows you to setup a server anywhere on your network that will pump-out data bytes (for download test) or sink bytes (for upload test), with whatever device you wanted connected as a client and doing the downloads/uploads. iPerf logs contain all that you should need. More here and in plenty more can easily be found.
 
Share this answer
 
there is 2 upload/download speeds:
- First is actual speed, which is volume (size of data) transmitted in a given time frame, it just need to hook on the device you want to test.
- Second is maximum speed, to get maximum speed, you need to ensure that you are at maximum speed, and the best way is to have a file transmitted saturate the interface.
If you don't saturate the link, you can't know the maximum speed.
 
Share this answer
 
The speed is mainly set by the slowest path between your system and the destination system.

But you can't identify that slowest path. Is at your sites connection to the internet, somewhere inbetween, or the destination internet connection?

With all pathes it depends on the actual network workload.
The inbetween pathes may change (that is how the internet works).
With your system and the destination system it depends on the system workload.

The only meaningful value is that of your internet connection which is usually specified by your provider (when not using a POT (Plain Old Telephone) line modem where it is set by the device).

When using DSL you might check if your modem provides the status of the actual connection. When a DSL modem connects with the DSLAM (Digital subscriber line access multiplexer - Wikipedia[^]) they do some line checks and negotiate a maximum speed for both directions. These speeds may be queried from the modem using the administration GUI and/or reading the system log file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900