Get the API of the device list
Typically, the first thing you do when writing WinPcap-based applications is to get a list of connected network adapters. Both libpcap and WinPcap provide the pcap_findalldevs_ex () function to do this: this function returns a linked list of pcap_if structures, each of which contains the details of an adapter. It is worth noting that the data fields name and description represent an adapter name and a description that people can understand.
To debug code in vs2008:
Runtime environment preparation: WpdPack_4_1_2 installation package
1: extract the WpdPack_4_1_2 and put it in the root directory of disk c, open Microsoft Visual Studio 2010, and copy the API code that gets the list of devices to the work panel, as follows
1234567891011121314151617 but can run when writing We need to configure some items-- > * * attribute (alt+F7) configuration property-- > inventory tool-- > input and output-- > embed list-- > No item-- > * * attribute (alt+F7) configuration property-- > CAccord Category configuration property-- > General-- > additional include directory-- > include (WpdPack_4_1_2 under disk c)-- > * * alt+F7 configuration properties-- > linker-- > general-- > additional library directory-- > lib (WpdPack_4_1_2 under disk c) items-- > * * properties (alt+F7) configuration properties-- > linker-- > input-- > additional dependencies-- > supplement " Packet.lib;wpcap.lib "Project-- > * * attribute (alt+F7) configuration property-- > Cmax Cleavage color color-- > preprocessor-- > preprocessor definition-- > supplement"; HAVE_REMOTE "
+ + +
In this way, the compilation does not report an error, and the compilation results can be seen.
This is a success!