internet speed

J

Jassim Rahma

I want to detect the internet speed using C# to show the user on what speed
he's connecting to internet?
 
J

Jassim Rahma

no, I want to know on what speed he's connected, for example, the ISP
account speed is 256K and I want to monitor that in order to let the user
check the upload and download speed, just like the one shown on the network
properties of MS Windows.
 
S

Sheng Jiang[MVP]

The ISP's speed limit is not available through any Windows API.
The one shown on the network properties of MS Windows is the capablity of
the network adapter.
 
P

Peter Duniho

no, I want to know on what speed he's connected, for example, the ISP
account speed is 256K and I want to monitor that in order to let the
user check the upload and download speed, just like the one shown on the
network properties of MS Windows.

As Sheng says, what Windows tells you isn't actually related to the ISP's
connection speed.

I'm not aware of any queryable value that will simply tell you the ISP's
connection speed. In many cases, the ISP's connection speed isn't static
anyway. Cable modems vary in actual throughput widely, and even DSL
connections get have bottlenecks, even if what's directly connected to the
customer is theoretically a static speed.

However, you can easily estimate the speed simply by transferring some
reasonably large piece of data and measuring how long it takes to
transfer. Something that takes 5 or 10 seconds should be sufficient to
give you a good "ballpark" number.

If you want to get really picky, make sure that the data you are sending
has been compressed already. Some network scenarios involve compressing
the data that's being transferred, which can give you a too-optimistic
view of what the nominal bandwidth of the connection is. Compressing it
first ensures that any compression algorithm in between isn't going to be
able to change the size of your data very much, giving you good
worst-case-scenario information.

Pete
 
D

David McCallum

no, I want to know on what speed he's connected, for example, the ISP
I don't know the answer, but I suspect he means how fast the current
operation is being transferred at

David
 
J

Jassim Rahma

well, if you connect to internet, move the cursor to the icon on the system
tray and you will see that you are connect with 64K or 32K or 120K or
whatever, that's what I want to get calculated..
 
P

Peter Duniho

well, if you connect to internet, move the cursor to the icon on the
system tray and you will see that you are connect with 64K or 32K or
120K or whatever, that's what I want to get calculated..

If you are using a dial-up adapter, it is true that many of the modem
drivers will report their actual connect speed. Similarly, a wireless
network drive _may_ report it's current connect speed.

But this information isn't useful generally, because only certain devices
report the speed that the device is actually connected at (for example,
some wireless adapters always look like 10Mbps devices, or 54Mbps devices,
or some other default value), _and_ in addition the speed that the device
is aware of may not be the actual Internet connection speed anyway (so
even if the device always reported as accurate information as it has, that
still won't tell you what you say you want to know).

As I wrote before: the only thing you can do to reliably know the
information you say you want to know is to measure it directly.

Pete
 
J

Jassim Rahma

the problem here is that the ISP is always promising the highest speend when
the delivered speed is not even to the half, that's why they provided a
website to show the user what is thier current internet speed at:

http://www.inetsupport.com.bh/meter/

and i just need to do the same using C#..
 
P

Peter Duniho

the problem here is that the ISP is always promising the highest speend
when the delivered speed is not even to the half, that's why they
provided a website to show the user what is thier current internet speed
at:

http://www.inetsupport.com.bh/meter/

and i just need to do the same using C#..

So what part of my previous answer are you having difficulty understanding?
 
G

Guest

Jassim said:
the problem here is that the ISP is always promising the highest speend
when the delivered speed is not even to the half, that's why they
provided a website to show the user what is thier current internet speed
at:

http://www.inetsupport.com.bh/meter/

and i just need to do the same using C#..

Try with some code like:

using System;
using System.Net;

namespace E
{
public class MainClass
{
public static double Speed(string url)
{
WebClient wc = new WebClient();
DateTime dt1 = DateTime.Now;
byte[] data = wc.DownloadData(url);
DateTime dt2 = DateTime.Now;
return (data.Length * 8) / (dt2 - dt1).TotalSeconds;
}
public static void Main(string[] args)
{
Console.WriteLine("speed to somewhere in Bahrain = " +
Speed("http://www.inetsupport.com.bh/meter/initialmeter.php")/1000 + "
Kbit/s");
Console.ReadLine();
}
}
}

It is obvious that you can not get a speed that are faster than your
internet connection.

But it is also obvious that you can get a speed that is much lower than
your internet connection, if the bottleneck between you and the server
are not your internet connection.

The program above gives a speed about 1/25 of my actual internet speed.
But then I am also a bit away from Bahrain, so I am not surprised.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top