gpt4 book ai didi

c - 使用 1 个套接字但不同端口加入多个多播组?

转载 作者:太空狗 更新时间:2023-10-29 12:04:47 24 4
gpt4 key购买 nike

我知道我可以用 1 个端口绑定(bind)到 INADDR_ANY,然后加入多个多播组。

但是,似乎无法绑定(bind)到 INADDR_ANY,然后加入具有不同端口的多个多播组,因为似乎必须在绑定(bind)期间指定端口,但套接字只能绑定(bind)一次。

有没有办法绕过它,以便我可以有 1 个套接字来监听具有不同端口的多个多播组?

提前致谢。

最佳答案

However, it seems like it is not possible to bind to INADDR_ANY

错了。

and then join multiple multicast groups with different ports

正确。

because it seems like the port has to be specified during binding but a socket can only bind once.

正确。

Is there a way to get around it so that I can have 1 socket to listen to multiple multicast groups with different ports?

没有。

关于c - 使用 1 个套接字但不同端口加入多个多播组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18759586/

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