c# - 使用 C# 计算网络带宽速度的最可靠方法是什么?

标签 c# .net bandwidth

使用 C# 计算网络带宽速度的最可靠方法是什么?

我找到了一些使用 NetworkInterface、性能计数器、 native Win32 代码等的示例,但它们都提供了不同的结果,而且似乎没有一个与其他已经存在的工具所显示的相匹配。

关于在 C# 中计算网络带宽速度的最可靠方法有什么建议吗?

编辑:为澄清起见,我希望知道特定接口(interface)当前消耗了多少带宽。

最佳答案

Same Question :

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.

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# - 使用 C# 计算网络带宽速度的最可靠方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2388198/

相关文章:

.net - Entity Framework - 记录上的读锁

c# - 我怎样才能告诉 AutoMapper 在我的目标类型上使用一个方法?

java - 用java下载文件,如何优化带宽

python - 如何使用 python 脚本从 eth0 获取带宽?

linux - 您如何衡量每个用户的下行带宽?

c# - 用于检查 x 是否以 y 开头的字符串的 IComparer

c# - Umbraco 检查节点是否仍然存在

c# - IDictionary<,> 逆变?

c# - 从 mysql 检索保存的图像时出现参数无效错误 c#

c# - LINQ 列表中按类型分组的项目总和列表