18,356
社区成员
发帖
与我相关
我的任务
分享
void EnumIP()
{
char szHostname[100];
HOSTENT *pHostEnt;
int nAdapter = 0;
gethostname( szHostname, sizeof( szHostname ));
pHostEnt = gethostbyname( szHostname );
while ( pHostEnt->h_addr_list[nAdapter] )
{
// pHostEnt->h_addr_list[nAdapter] is the current address in host
// order.
nAdapter++;
}
}