2012-12-25 53 views

回答

-1

你可以看看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的驅動程序必須在系統上安裝。

+0

-1。當真?安裝一個驅動程序來做一些你可以用WMI開箱即可完成的事情?像保持程序這樣堅實的原則發生了什麼事情只安裝了必要條件? – TomTom

+0

我想它保持了簡單的SILLY,他們分手了。 – nurettin

0
+0

我無法打開超鏈接,請確認它是否存在 –

+0

:我在MSDN中查看了Win32_PerfFormattedData_Tcpip_NetworkInterface類的屬性,它顯示大多數數據是類型(值/秒),即每秒數據包或每秒字節數並沒有CUMULATIVE計數可用? –

0

首先,你必須

using System.Net.NetworkInformation; 

接下來,您必須:

var iFaceArr = NetworkInterface.GetAllNetworkInterfaces(); 
NetworkInterface iface = iFaceArr[0]; 
IPv4InterfaceStatistics iFaceStats = iface.GetIPv4Statistics(); 

然後你有這些變量:

iFaceStats.UnicastPacketsReceived; 
iFaceStats.UnicastPacketsSent; 
iFaceStats.NonUnicastPacketsReceived; 
iFaceStats.NonUnicastPacketsSent; 

Reference