Get the list of Devices API

Source: Internet
Author: User
Tags visual studio 2010

In general, the first thing to write a WinPcap-based application is to get a list of connected network adapters. Both Libpcap and WinPcap provide the PCAP_FINDALLDEVS_EX () function to implement this function: This function returns a list of pcap_if structures, each of which contains the details of an adapter. It is important to note that the data field name and description represent an adapter name and a description that people can understand.


Steps to debug your code in VS2008:

Operational Environment Preparation: Wpdpack_4_1_2 installation package

1: Put Wpdpack_4_1_2 unzip in the C packing directory, open Microsoft Visual Studio 2010, copy the API code to get the device list to the work panel, the code is as follows 650) this.width=650; "Src=" http ://s5.51cto.com/wyfs02/m01/89/4a/wkiol1gpcomsk5vfaabvt-pekgy600.png "title=" CQ (q87{6judqlu~s4c3ulot.png "alt=" Wkiol1gpcomsk5vfaabvt-pekgy600.png "/>

However, when you can run the write, you can find that it is an error when we want to configure some things Project-->** properties (ALT+F7) configuration Properties---inventory tools--input and output----embedded list--no Project-->** properties (ALT + F7) Configuration Properties-->c/c++--> General-and additional include directory-->include (Wpdpack_4_1_2 under C-drive) Project-->** properties (ALT+F7) configuration Properties--linker-- General--Additional library directory-->lib (Wpdpack_4_1_2 under the C-disk) Project-->** properties (ALT+F7) configuration Properties--linker--Add dependencies--add "; Packet.lib;wpcap.lib "Project-->** Property (ALT+F7) configuration property-->c/c++--> Preprocessor---preprocessor definition--supplemental"; Have_remote "

++++++++++++++++++++++++++++++++++++++++++++++++++++++

This compiles without an error, the compilation results can be seen

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/89/4A/wKioL1gPDB7QBvHYAABY8jJ1IPg098.png "title=" SO4FA} Bi6ezq5[i (DXP ' rsw.png "alt=" Wkiol1gpdb7qbvhyaaby8jj1ipg098.png "/>

This is the success!!!



Get the list of Devices API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.