C# 用C语言只计算互联网使用率#

C# 用C语言只计算互联网使用率#,c#,network-interface,C#,Network Interface,我正在做一个互联网使用量表,它可以计算个人电脑每天的互联网使用量。 我在下面的代码中被用来上下读取数据 NetworkInterface nic = nicArr[0]; //select internet connected Interface IPv4InterfaceStatistics interfaceStats = nic.GetIPv4Statistics(); lblBytesReceived.Text = interfaceStats.BytesReceived.ToStr

我正在做一个互联网使用量表,它可以计算个人电脑每天的互联网使用量。 我在下面的代码中被用来上下读取数据

NetworkInterface nic = nicArr[0]; //select internet connected Interface

IPv4InterfaceStatistics interfaceStats = nic.GetIPv4Statistics();

lblBytesReceived.Text = interfaceStats.BytesReceived.ToString(); //DOWNLOAD
lblBytesSent.Text = interfaceStats.BytesSent.ToString();  //UPLOAD

它在没有连接到本地网络的PC上运行良好。但当它在连接到本地网络的计算机上工作时,本地计算机之间传输的字节也会增加互联网的使用。(如果我将文件复制到网络pc,那么它也会计算),但我只需要过滤为互联网使用而传输的数据。我怎样才能做到这一点?

你对这个主题做过研究吗?可能的重复你对这个主题做过研究吗?可能的重复