Extracting network interface information The most important two functions are GetNumberofinterFaces and GetInterfaceInfo, the former points out the number of network interfaces, and the latter extracts information about the network interface. For the first function to explain, it seems that it doesn't return the correct value, because according to the MSDN description: A network interface is a logic abstraction of the NIC, which is a one-on-one relationship. And the actual situation is that there is only one network card on my machine, but this function returns 2. In fact, because each system is attached to a debugged network interface, the IP address of this interface is 127.0.0.1 subnet mask is 255.0.0.0. This result can be seen from the output of the program. There is also a Numadapters integer data field recorded the correct NN card in the IP_Interface_info structure returned by GetInterfaceInfo. Then pay for GetInterfaceInfo is that it must also be called twice, the first acquisition buffer size, the second is the value. Then I feel that I misey that the ip_interface_info returned by GetInterfaceInfo is not like the structure above, but the way to use the dynamic array (to now there is a linear structure), so spread the code of each element. Change: for (int i = 0; inumadapters; i ) {cout << "Adapter Index:"