SharpPcap c#抓包实现时时获取网卡信息
SharpPcap tutorial: a step by step guide to using SharpPcap
The text of this tutorial is taken directly from WinPcap's official tutorial but is modified to show the C# use of the SharpPcap library. All examples can be downloaded together with SharpPcap source code from SharpPcap 's homepage. The WinPcap library must be installed before attempting to run any of these examples, so please download and install the latest version from WinPcap's download page.
SharpPcap was written and tested using .NET v1.1 and Windows 2000/XP. I have no idea about other .NET and Windows versions. If you do try it, please report your results.
The following topics are covered in this tutorial:
Obtaining the device list
Obtaining advanced information about installed devices
Opening an adapter and capturing packets
Capturing packets without the event handler
Filtering the traffic
Interpreting the packets
Handling offline dump files
Sending Packets
Gathering Statistics on the network traffic
1. Obtaining the device list