我正在尝试获取网络流量的URL,即用户使用c#中的NetworkInterface访问的网站。我可以通过以下代码获得总字节数:
我正在寻找通过URL获取网络流量的方法。
if (!NetworkInterface.GetIsNetworkAvailable())
return;
NetworkInterface[] interfaces
= NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface ni in interfaces)
{
Console.WriteLine(" Bytes Sent: {0}",
ni.GetIPv4Statistics().BytesSent);
Console.WriteLine(" Bytes Received: {0}",
ni.GetIPv4Statistics().BytesReceived);
}