如何从网络流量中获取URL

时间:2020-10-15 05:45:47

标签: c#

我正在尝试获取网络流量的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);
            }

0 个答案:

没有答案