gpt4 book ai didi

linux - 辅助数据 : ‘IP_RECVIF’ undeclared (first use in this function)

转载 作者:太空宇宙 更新时间:2023-11-04 10:34:45 25 4
gpt4 key购买 nike

我想接收数据到达接口(interface)的ifindex。为此,我正在使用辅助数据。当我编译我的程序时,我得到

src/igmp_pkt_reciever.c:49:21: error: ‘IP_RECVIF’ undeclared (first use in this function)

作为explained here , 常量应在 sys/socket.h 中定义.我已经包含了这个头文件,但我看到了编译错误。谁能帮忙。

最佳答案

IP_RECVIF 不是 Linux 套接字选项;您链接到的文档是 Oracle 的 Solaris 文档。来自 Linux socket(7)

Some other BSD sockets implementations provide IP_RCVDSTADDR and IP_RECVIF socket options to get the destination address and the interface of received datagrams. Linux has the more general IP_PKTINFO for the same task.

因此您需要改用IP_PKTINFO。上面的网页提供了如何使用它的详细信息。

关于linux - 辅助数据 : ‘IP_RECVIF’ undeclared (first use in this function),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38131667/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com