Home > Back-end >  Specify the nic card information (such as gateway IP)
Specify the nic card information (such as gateway IP)

Time:10-09

Now understand that you can use GetAdaptersInfo () for all the network adapter on host information, of course, this information is stored in a list, now want to ask you, is there by the name of the network adapter or descriptor method of direct access to the network adapter card information (for a single specified card information)

CodePudding user response:

The general idea is that
 
IP_ADAPTER_INFO AdapterInfo [1024].
DWORD dwBufLen=sizeof (AdapterInfo);
DWORD dwStatus=GetAdaptersInfo (AdapterInfo, & amp; DwBufLen);
PIP_ADAPTER_INFO pAdapterInfo=AdapterInfo;
Do
{
LAN_RouteFile [LANFoundQty]. Interface=pAdapterInfo - & gt; The Index;
LAN_RouteFile [LANFoundQty] IPAddr=pAdapterInfo - & gt; IpAddressList. IpAddress. String;
LAN_RouteFile [LANFoundQty] Mask=pAdapterInfo - & gt; IpAddressList. IpMask. String;
LAN_RouteFile [LANFoundQty]. The Gateway=pAdapterInfo - & gt; GatewayList. IpAddress. String;

PAdapterInfo=pAdapterInfo - & gt; Next;//Progress through linked list
LANFoundQty + +;
} while (pAdapterInfo);

CodePudding user response:

According to the network adapter name
  • Related