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

标签 networking tcp udp delay

我读了一些有关 PAWS(防止包裹序列)的内容。这很有趣。我不知道实现了这么复杂的东西来保证TCP的可靠性。如果没有PAWS,在高数据速率的情况下,可能会接收到延迟的旧数据包并误认为是新数据包。

之前我并没有想太多。但现在我开始想知道数据包可以在网络中保留多长时间(特别是 UDP 数据包,如果数据包的类型很重要)。数据包可能会被延迟,在传送之前暂时停留在网络中。但它只能停留很短一段时间,对吗?

换句话说,在断定(UDP)数据包不会到达之前需要等待多少时间?

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


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

最佳答案

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

关于networking - 延迟的数据包可以持续多长时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32752729/

相关文章:

networking - 防火墙:2路UDP通信可能吗?

Java客户端从C服务器接收,但C服务器不从Java客户端接收

c++ - Mumble/Google protobufs 客户端读取数据函数错误

sockets - 在服务器窗口结束之前客户端发送确认消息的原因是什么?

php - 是否可以在 PHP 中使用 TCP/IP 套接字访问本地打印机?

python - 实用数据科学食谱Python代码

c# - Lidgren 的 UPnP 和端口转发失败

iphone - 我如何检测真实的网络可用性?

java数据报套接字未收到(本地主机)

node.js - UDP 多播失败 - NodeJS/Windows 10