本文介绍了如何显示上传和下载带宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好.
有谁知道如何使用c#根据网络速度找出每kb/秒上载多少带宽?
有谁知道如何使用c#根据网速找出正在下载多少kb/sec的带宽?
以及如何基于kb/sec限制带宽.
hi to all..
Does any body knows how to find out how much bandwidth is uploading per kb/sec based on net speed using c#?
Does any body knows how to find out how much bandwidth is downloading kb/sec based on net speed using c#?
and how to restrict that bandwidth based on kb/sec..
if anybody knows please let me know the solution..
推荐答案
IPv4InterfaceStatistics stats = NetworkInterface.GetAllNetworkInterfaces()[0].GetIPv4Statistics();
int bytesSentSpeed = 0;
int bytesReceivedSpeed = 0;
bytesSentSpeed = (int)(stats.BytesSent - bytesSentSpeed) / 1024;
bytesReceivedSpeed = (int)(stats.BytesReceived - bytesReceivedSpeed) / 1024;
至于限制带宽,我认为在C#中是不可能的.
希望对您有帮助
AS far as limiting the bandwidth, I don''t think it is possible in C#.
Hope this helps
这篇关于如何显示上传和下载带宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!