. 参考: https://wenku.baidu.com/view/74c59947336c1eb91a375dbe.html 家里配置如下 尾部的1不要忘了 netsh interface ip set address "以太网" static 192.168.2.111 255.255.255.0 192.168.2.1 1netsh interface ip set dns "以太网" static 218.108.248.200 公司配置如下 尾部的1不要
getifaddrs()和struct ifaddrs的使用,获取本机IP ifaddrs结构体定义如下: struct ifaddrs { struct ifaddrs *ifa_next; /* Next item in list */ char *ifa_name; /* Name of interface */ unsigned int ifa_flags; /* Flags from SIOCGIFFLAGS */ struct sockaddr *ifa_addr; /* Addre