Linux下获取网卡名称的3种方法
在Linux中获取网卡名称的方法如下几种,1和2两种没办法在网卡未分配IP地址时获取:1.采用socket方式获取网卡列表int EthManager::listInterface(){ int fd; int interface_num = 0,i = 0; struct ifreq ifbuffer[10]; struct ifconf ifc; if((fd = socket(AF_INET,SOCK_DGRAM,IPPROTO_IP)) < ...
原创
2021-05-11 10:12:06 ·
9216 阅读 ·
0 评论