延迟数据包可以持续多长时间?

How long can a delayed packet persist?

我读了一些关于 PAWS(Protection Against Wrapping Sequence)的内容。这很有趣。我不知道实施如此复杂的事情来保证TCP的可靠性。没有PAWS,在高数据率的情况下,一个延迟的旧数据包会被误认为是新数据包。

我之前没想太多。但是现在我开始想知道一个数据包可以在网络中停留多长时间(如果数据包类型很重要,尤其是 UDP 数据包)。数据包可能会延迟,在交付之前暂时停留在网络中。但是也只能停留很短的时间吧?

换句话说,等待一个 (UDP) 数据包需要多长时间才能断定它不会来?

如果有答案,那又是如何确定的呢?怎么估计呢? (用于编写与数据包超时相关的程序。)


一个简单的例子:一个服务器收到了2个UDP数据包。每个都包含一个整数来指示顺序。它获得了第一名和第三名。它知道 2 号不是延误了就是丢失了。过了一段时间,No.2还是没有来,就断定丢包了。该数据包不再存在。 (所以不会对以后的新包造成什么麻烦,类似PAWS要解决的问题。)但是服务器要等多久才能断定No.2不存在了?

UDP 是一种即发即弃的尽力而为协议。接收主机并不期望 UDP 数据包即将到来。上层可以使用自己的保证或期望,但 UDP 有 none.

UDP 不像 TCP 那样等待数据包。

RFC 791 #3.2:

Time to Live

The time to live is set by the sender to the maximum time the datagram is allowed to be in the internet system. If the datagram is in the internet system longer than the time to live, then the datagram must be destroyed.

This field must be decreased at each point that the internet header is processed to reflect the time spent processing the datagram. Even if no local information is available on the time actually spent, the field must be decremented by 1. The time is measured in units of seconds (i.e. the value 1 means one second). Thus, the maximum time to live is 255 seconds or 4.25 minutes. Since every module that processes a datagram must decrease the TTL by at least one even if it process the datagram in less than a second, the TTL must be thought of only as an upper bound on the time a datagram may exist. The intention is to cause undeliverable datagrams to be discarded, and to bound the maximum datagram lifetime.