int get_ip_num()
{
struct hostent * Host;
char hostname[512];
int ip_num = 0;
if (gethostname(hostname, 512) != 0)
{
return -1;
}
Host = gethostbyname(hostname);
if (Host == NULL)
{
return -1;
}
if (Host->h_addrtype == AF_INET)
{
int i = 0;
struct in_addr addr;
while (Host->h_addr_list[i] != 0)
{
i++;
ip_num++;
}
}
return ip_num;
}