如何在c ++中获取所有网络接口名称和信息 [英] How to get all network interface name and information in c++
本文介绍了如何在c ++中获取所有网络接口名称和信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用c ++在Linux中获取所有网络接口(向上或向下)名称和可用信息?我的意思是一个程序只使用 API 来获取接口的名称。
ioctl打印下接口?
Is it possible to get all network interfaces(whether up or down) name and available information in Linux using c++? I mean a program that only uses API to get interface's name. Does "ioctl" print down interfaces?
推荐答案
您可以使用C API和getifaddrs函数执行此操作: http ://man7.org/linux/man-pages/man3/getifaddrs.3.html
Not specially for C++, but you can use the C API and the 'getifaddrs' function to do so: http://man7.org/linux/man-pages/man3/getifaddrs.3.html
这篇关于如何在c ++中获取所有网络接口名称和信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文