Extract Network Interface Information
The two main functions are getnumberofinterfaces and getinterfaceinfo. The former indicates the number of network interfaces, and the latter extracts information about network interfaces. One thing to note about the first function is that it does not seem to return the correct value, because according to msdn: a network interface is the logical abstraction of the network card, and they are a one-to-one relationship. The actual situation is that there is only one Nic on my machine, but this function returns 2. In fact, each system attaches a network interface for debugging. The IP address of this interface is 127.0.0.1, And the subnet mask is 255.0.0.0. This result can beProgram. The ip_interface_info structure returned by getinterfaceinfo also contains a numadapters integer data field that records the correct Nic. Then, you must note that getinterfaceinfo must be called twice to obtain the buffer size for the first time and the value for the second time. Again, what makes me feel strange is that the ip_interface_info returned by getinterfaceinfo does not use the linked list instead of the above structure, but uses the dynamic array method (which linear structure is used up now ), thereforeCodeTo:
For (INT I = 0; inumadapters; I ++)
{
Cout
Previous:Easily implement Internet filtering in Linux
Next article:Ajax development using Ajax. dll