读书人

C#中如何获取本机当前的网络流量

发布时间: 2012-01-14 20:02:35 作者: rapoo

C#中怎么获取本机当前的网络流量?
我查了一下,看着System.Net.NetworkInformation;这里面的方法有点像,但一直没有找到网络流量,大家帮忙看一下,先谢了。

[解决办法]
PGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
IPGlobalStatistics ipstat = properties.GetIPv4GlobalStatistics();
Console.WriteLine( " Inbound Packet Data: ");
Console.WriteLine( " Received ............................ : {0} ",
ipstat.ReceivedPackets);
Console.WriteLine( " Forwarded ........................... : {0} ",
ipstat.ReceivedPacketsForwarded);
Console.WriteLine( " Delivered ........................... : {0} ",
ipstat.ReceivedPacketsDelivered);
Console.WriteLine( " Discarded ........................... : {0} ",
ipstat.ReceivedPacketsDiscarded);
[解决办法]
【翻译】网络性能监视器
http://bbs.msproject.cn/Default.aspx?g=posts&t=63

读书人网 >C#

热点推荐