How to get all network interface name and information in c++

放肆的年华 提交于 2020-02-05 03:44:49

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/18495619/how-to-get-all-network-interface-name-and-information-in-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!