检测网络连接速度,并在C#中的带宽使用 [英] Detecting network connection speed and bandwidth usage in C#

查看:1901
本文介绍了检测网络连接速度,并在C#中的带宽使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来检测在C#中的网络速度和带宽的使用?甚至指向开源组件的欢迎。先谢谢了。

Is there a way to detect the network speed and bandwidth usage in C#? Even pointers to open-source components are welcome. Thanks in advance.

推荐答案

尝试使用System.Net.NetworkInformation类。尤其是,<一href=\"http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ipv4interfacestatistics.aspx\"><$c$c>System.Net.NetworkInformation.IPv4InterfaceStatistics应该走的,你在找什么线路的一些信息。

Try using the System.Net.NetworkInformation classes. In particular, System.Net.NetworkInformation.IPv4InterfaceStatistics ought to have some information along the lines of what you're looking for.

具体而言,您可以检查与BytesReceived 属性,等待一个给定的时间间隔,然后再次检查与BytesReceived 属性拿到多少字节/秒的连接正在处理的想法。为了获得良好的数字,但是,你应该尝试从给定的来源下载的信息大块,检查即可;这样,你应该是'杏'的连接,当你做了测试,这应该给更多的帮助号码。

Specifically, you can check the bytesReceived property, wait a given interval, and then check the bytesReceived property again to get an idea of how many bytes/second your connection is processing. To get a good number, though, you should try to download a large block of information from a given source, and check then; that way you should be 'maxing' the connection when you do the test, which should give more helpful numbers.

这篇关于检测网络连接速度,并在C#中的带宽使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆