简体   繁体   English

具有两个不同套接字的多播加入组

[英]Multicast join group with two different sockets

I'm creating multicast server/client udp application in C in which server is sending data to multicast group of clients, and if data is not received, clients request for retransmission. 我正在C中创建多播服务器/客户端udp应用程序,其中服务器正在将数据发送到客户端的多播组,如果未接收到数据,则客户端请求重传。 I thought to create two sockets on server and client side. 我想在服务器端和客户端创建两个套接字。 On server side one socket for sending multicast and another for receiving replies from clients. 在服务器端,一个套接字用于发送多播,另一个套接字用于接收来自客户端的答复。 And on client side one socket for receiving data and another for reply back to server. 在客户端,一个套接字用于接收数据,另一个套接字用于回复服务器。 What is confusing me is because socket is connected to multicast group...client join on that group with socket. 令我感到困惑的是,因为套接字已连接到多播组...客户端通过套接字加入了该组。 Can I use two sockets and one multicast group or should I create two groups ? 我可以使用两个套接字和一个多播组,还是应该创建两个组? What is the most efficient solution? 什么是最有效的解决方案? I can not have delays because it will be in real time...do you have some advice ? 我不能拖延,因为它将是实时的...您有什么建议吗?

Thx 谢谢

On server side one socket for sending multicast and another for receiving replies from clients. 在服务器端,一个套接字用于发送多播,另一个套接字用于接收来自客户端的答复。

Definitely not. 当然不。

And on client side one socket for receiving data and another for reply back to server. 在客户端,一个套接字用于接收数据,另一个套接字用于回复服务器。

Definitely not. 当然不。

Peers will always want to respond back to the IP:port the request came from. 对等方总是希望回复请求来自的IP:端口。 If you add another port you add an endless configuration difficulty. 如果添加另一个端口,则会增加无尽的配置难度。 If you only use one port it's easy. 如果只使用一个端口,这很容易。 There is no performance or architectural reason to use two ports per process for this. 没有性能或体系结构上的原因,每个进程要使用两个端口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM