Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在 Socket 编程中包含一个 IP 数据包。我有一个包含 igmp 数据包的现成 Ip 数据包。我不想设计 igmp 协议,但想使用该数据包发送 igmp 查询。通过某种方式,我必须将 Ip 数据包识别为 IP 数据包而不是 TCP/UDP 数据。
您必须将原始套接字与sendmsg一起使用。这需要root许可。
root
如果您想发送 IGMP 数据包,您应该使用 setsockopt() API 来执行此操作。