string localip = "";
int fd;
struct ifconf if_conf; /* net/if.h */
struct sockaddr_in *sin;
fd = socket(PF_INET, SOCK_DGRAM, 0);
if_conf.ifc_req = (struct ifreq *)malloc(MaxIFs * sizeof(struct ifreq));
if_conf.ifc_len = MaxIFs * sizeof(struct ifreq);
if(ioctl(fd, SIOCGIFCONF, &if_conf) == -1)
{
free(if_conf.ifc_req);
close(fd);
return "取IP信息失败";
}