Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programmatically check Internet bandwidth in VC++?

I need to find the bandwidth available at a particular time. The code must be developed in Visual C++ or in .Net family . If anyone knows how, please help me out.

like image 575
subbu Avatar asked Apr 08 '09 09:04

subbu


People also ask

How do I test my bandwidth and speed?

Start with your internet service provider's (ISP's) online speed test, then use ones like Speedtest by Ookla and Fast.com by Netflix. Run the tests multiple times to account for variability, and use wired connection instead of Wi-Fi for the best results.

How can I get mobile internet speed in my programmatically?

getSystemService(CONNECTIVITY_SERVICE); NetworkCapabilities nc = cm. getNetworkCapabilities(cm. getActiveNetwork()); var downSpeed = nc. getLinkDownstreamBandwidthKbps(); var upSpeed = nc.

What is bandwidth in CS?

Bandwidth is the data transfer capacity of a computer network in bits per second (Bps). The term may also be used colloquially to indicate a person's capacity for tasks or deep thoughts at a point in time.


3 Answers

The only way to check your bandwidth is to actually try to use it, i.e. by downloading a file from somewhere else and measuring the throughput.

Even then it'll only be an approximation, because other network effects will affect the results:

  • latency
  • asymmetric upload / download
  • other traffic
like image 80
Alnitak Avatar answered Sep 30 '22 22:09

Alnitak


If you mean the current network utilisation, you can call

DeviceIoControl(hDevice, OID_GEN_STATISTICS, ...)

on Vista and above to get the device-specific information. Otherwise, call GetIpStatisticsEx for system-wide information or use WMI's Win32_PerfRawData_Tcpip_NetworkInterface.

Trying to get the "available" bandwidth by attempting to saturate the connection is not a sensible or reliable measure. Just try some of the online speed tests available, and consider that it involves non-scalable bandwidth, and is susceptible to congestion control, QoS and traffic shaping.

like image 39
Mark Avatar answered Sep 30 '22 21:09

Mark


Checking the bandwidth will be tricky even by using it. if you try to download data from remote machine X for example and you estimate a figure of N Kbs then how will you know whether that's your bandwidth limitation or the limitation of remote machine X's connection?

You'd need to start simultaneous downloads (or uploads if that's the direction you want to measure) with several remote machines simultaneously and keep increasing the load until the throughput stops increasing.

But as Alnitak said you still won't know what other factors might be affecting the result. Is some other process on your machine using the connection for example? or is the kid next door piggybacking on your wireless LAN and stealing your bandwidth? Maybe that's what you're trying to find out!

like image 26
Paul Mitchell Avatar answered Sep 30 '22 22:09

Paul Mitchell