0

我在 C 中创建多播服务器/客户端 udp 应用程序,其中服务器正在向多播客户端组发送数据,如果未收到数据,则客户端请求重新传输。我想在服务器端和客户端创建两个套接字。在服务器端,一个套接字用于发送多播,另一个用于接收来自客户端的回复。在客户端,一个套接字用于接收数据,另一个用于回复服务器。让我感到困惑的是因为套接字连接到多播组......客户端使用套接字加入该组。我可以使用两个套接字和一个多播组还是应该创建两个组?什么是最有效的解决方案?我不能有延迟,因为它将是实时的……你有什么建议吗?

谢谢

4

1 回答 1

0

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. 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.

于 2014-03-19T07:11:43.720 回答