ネットワーク カードの送受信パケット数 (IP レベル : TCP、UDP などを含む) に関する統計を取得したい。
Windows からその情報を照会するにはどうすればよいですか?
ネットワーク カードの送受信パケット数 (IP レベル : TCP、UDP などを含む) に関する統計を取得したい。
Windows からその情報を照会するにはどうすればよいですか?
WMI。
C# から使用するのは簡単ではありませんが、可能です。
必要なクラスのドキュメントは次の場所にあります
まずあなたが持っている
using System.Net.NetworkInformation;
次にあなたが持っている:
var iFaceArr = NetworkInterface.GetAllNetworkInterfaces();
NetworkInterface iface = iFaceArr[0];
IPv4InterfaceStatistics iFaceStats = iface.GetIPv4Statistics();
次に、これらの変数があります。
iFaceStats.UnicastPacketsReceived;
iFaceStats.UnicastPacketsSent;
iFaceStats.NonUnicastPacketsReceived;
iFaceStats.NonUnicastPacketsSent;
Pcap.Netをご覧ください。
Getting the list of Live Devices on the local host. Reading packets from Live Devices (Network Devices) and Offline Devices (Files) using the different WinPcap methods. Receiving statistics on the entire capture. Receiving statistics of packets instead of the full packets. Using different sampling methods. Applying Berkley Packet Filters. Sending packets to Live Devices directly or using WinPcap's send queues. Dumping packets to Pcap files. Using Enumerables to receive packets (and LINQ).
winpcap ドライバーをシステムにインストールする必要があることに注意してください。