How to programmatically check Internet bandwidth in VC++?

后端 未结 3 1402
南笙
南笙 2020-12-10 17:48

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.

3条回答
  •  無奈伤痛
    2020-12-10 18:22

    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.

提交回复
热议问题