本文介绍了如何获取指定适配器的互联网流量信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取指定适配器的Internet流量(已接收和已发送字节)的信息?
请帮忙。
How to get info about Internet traffic(received & sent bytes) for specified adapter?
Please help.
推荐答案
var interfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface nic in interfaces.Where(m=>m.Name = "Your Specific Interface Name Here"))
{
Console.WriteLine("{0}: Bytes Sent {1}", nic.Name, nic.GetIPv4Statistics().BytesSent);
Console.WriteLine("{0}: Bytes Received {1}", nic.Name, nic.GetIPv4Statistics().BytesReceived);
}
这篇关于如何获取指定适配器的互联网流量信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!