c - 如何在 C 中获取事件网络接口(interface)的列表?

标签 c sockets unix networking

如何使用C获取系统中的事件接口(interface)列表?我需要使用什么 API 或库?我可以选择一个特定的接口(interface)来在套接字编程中发送数据吗?如果是,请举例说明。

最佳答案

如果在 Linux 上,您可能想看看:

int getifaddrs(struct ifaddrs **ifap);

The getifaddrs() function creates a linked list of structures describing the network interfaces of the local system, and stores the address of the first item of the list in *ifap.

关于c - 如何在 C 中获取事件网络接口(interface)的列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18146236/

相关文章:

Linux 用户更改所有者/组的权限

bash - 有没有办法找到 PATH 设置的位置?

c - 将字符串数组覆盖在字符数组上

c++ - 对常规文件进行 Epoll

c - 找出与 sendto 函数中使用的套接字关联的 src IP 和端口

c - C 中的 UNIX 域套接字编程,打印问题

c++ - `ifreq` 结构中的 IPv6 地址问题

linux - 试图捕获 Linux 机器上的所有内存读/写

c - 将字符串拆分为C中的单词数组

c++ - 有没有更简单的实例化静态库的方法?