简体   繁体   English

实现UDP组播可靠的方法

[英]Methods for implementing UDP multicast reliable

I am preparing for my university exam and one of the question last year was " how to make UDP multicast reliable " ( like tcp, retransmission of lost packets )我正在准备我的大学考试,去年的一个问题是“如何使 UDP 多播可靠”(如 tcp,丢失数据包的重传)

I thought about something like this :我想过这样的事情:

  1. Server send multicast using UDP服务器使用 UDP 发送多播

  2. Every client send acknowledgement of receiving that packets ( using TCP )每个客户端发送接收该数据包的确认(使用 TCP)

  3. If server realize that not everyone receive packets , it resends multicast or unicast to particular client如果服务器意识到不是每个人都收到数据包,它会向特定的客户端重新发送多播或单播。

The problem are that there might be one client who usually lost packets and force server to resend.问题是可能有一个客户端通常会丢失数据包并强制服务器重新发送。

Is it good ?好吗 ?

Every client send acknowledgement of receiving that packets ( using TCP )每个客户端发送接收该数据包的确认(使用 TCP)

Sending an ACK for each packet, and using TCP to do so, is not scalable to a large number of receivers.为每个数据包发送一个 ACK​​,并使用 TCP 来这样做,不能扩展到大量接收者。 Using a NACK based scheme is more efficient.使用基于 NACK 的方案更有效。

Each packet sent from the server should have a sequence number associated with it.从服务器发送的每个数据包都应该有一个与之关联的序列号。 As clients receive them, they keep track of which sequence numbers were missed.当客户收到它们时,他们会跟踪丢失了哪些序列号。 If packets are missed, a NACK message can then be sent back to the server via UDP.如果数据包丢失,则可以通过 UDP 将 NACK 消息发送回服务器。 This NACK can be formatted as either a list of sequence numbers or a bitmap of received / not received sequence numbers.此 NACK 可以格式化为序列号列表或已接收/未接收序列号的位图。

If server realize that not everyone receive packets , it resends multicast or unicast to particular client如果服务器意识到不是每个人都收到数据包,它会向特定的客户端重新发送多播或单播。

When the server receives a NACK it should not immediately resend the missing packets but wait for some period of time, typically a multiple of the GRTT (Group Round Trip Time -- the largest round trip time among the receiver set).当服务器收到 NACK 时,它不应立即重新发送丢失的数据包,而是等待一段时间,通常是 GRTT(组往返时间 - 接收器组中最大的往返时间)的倍数。 That gives it time to accumulate NACKs from other receivers.这使它有时间积累来自其他接收器的 NACK。 Then the server can multicast the missing packets so any clients missing them can receive them.然后服务器可以多播丢失的数据包,以便任何丢失它们的客户端都可以接收它们。

If this scheme is being used for file transfer as opposed to streaming data, the server can alternately send the file data in passes.如果此方案用于文件传输而不是流数据,则服务器可以交替发送文件数据。 The complete file is sent on the first pass, during which any NACKs that are received are accumulated and packets that need to be resent are marked.完整的文件在第一次通过时发送,在此期间接收到的任何 NACK 都会被累积,并标记需要重新发送的数据包。 Then on subsequent passes, only retransmissions are sent.然后在随后的传递中,只发送重传。 This has the advantage that clients with lower loss rates will have the opportunity to finish receiving the file while high loss receivers can continue to receive retransmissions.这样做的好处是丢失率较低的客户端将有机会完成接收文件,而高丢失率的接收器可以继续接收重传。

The problem are that there might be one client who usually lost packets and force server to resend.问题是可能有一个客户端通常会丢失数据包并强制服务器重新发送。

For very high loss clients, the server can set a threshold for the maximum percentage of packets missed.对于非常高丢失的客户端,服务器可以设置丢失数据包的最大百分比的阈值。 If a client sends back NACKs in excess of that threshold one or more times (how many times is up to the server), the server can drop that client and either not accept its NACKs or send a message to that client informing it that it was dropped.如果客户端发回超过该阈值的 NACK 一次或多次(多少次取决于服务器),则服务器可以丢弃该客户端并且要么不接受其 NACK,要么向该客户端发送消息通知它掉了。


There are a number of protocols which implement these features:有许多协议可以实现这些功能:

Relevant RFCs:相关 RFC:

To make UDP reliable, you have to handle few things (ie, implement it yourself).为了使 UDP 可靠,您必须处理一些事情(即,自己实现)。

Connection handling: Connection between the sending and receiving process can drop.连接处理:发送和接收进程之间的连接可以断开。 Most reliable implementations usually send keep-Alive messages to maintain the connection between the two ends.最可靠的实现通常会发送 keep-Alive 消息来维护两端之间的连接。

Sequencing: Messages need to split into chunks before sending.排序:消息在发送前需要拆分成块。

Acknowledgement: After each message is received an ACK message needs to be send to the sending process. Acknowledgement:收到每条消息后,需要向发送进程发送一条ACK消息。 These ACK messasges can also be sent through UDP, doesn't have to be through UDP.这些 ACK 消息也可以通过 UDP 发送,不必通过 UDP。 The receiving process might realise that has lost a message.接收进程可能会意识到丢失了一条消息。 In this case, it will stop delivering the messages from the holdback queue (queue of messages that holds the received messages, it is like a waiting room for messages), and request of a retransmission of the missing message.在这种情况下,它将停止传递来自holdback queue(保存接收到的消息的消息队列,就像消息的等待室)中的消息,并请求重新传输丢失的消息。

Flow control: Throttle the sending of data based on the abilities of the receiving process to deliver the data.流量控制:根据接收进程传递数据的能力来限制数据的发送。

Usually, there is a leader of a group of processes.通常,有一组进程的领导者。 Each of these groups normally have a leader and a view of the entire group.这些组中的每一个通常都有一个领导者和整个组的视图。 This is called a virtual synchrony.这称为虚拟同步。

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

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