问题描述
我知道 UDP 并不总是按顺序或根本不接收数据包,但我如何找出原因?是数据包在传输中丢失或重新排序.例如,不同的数据包采用不同的路线并在不同的时间到达.还是损坏的数据包被重新发送并因此延迟到达?
I know that UDP doesn't always receive packets in order or at all, but how can i find out why? Is it that the packets get lost or reordered in the transport. eg different packets take different routes and arrive at different times. or is it that corrupt packets get resent and thus arrive later?
我希望可以在帖子中回答这个问题,但如果您可以将我重定向到一个更好的来源,也将不胜感激.
I would prefer if this could be answered in post, but if you could redirect me to a better source that would also be appreciated.
推荐答案
出于速度和效率的目的,数据包不是按顺序接收的,这意味着任何数据包都可以采取任何路由,而不必等待任何其他数据包已经到达/发送.因为可靠性不是 UDP 的主要关注点之一,所以它并不关心.
For purposes of speed and efficiency packets aren't received in order, meaning any packet can take any route and doesn't have to wait for any other packet to have arrived/sent. Because reliability is not one of the main concerns of UDP, it doesn't care.
丢弃的数据包也不会重新发送,因为两端都没有进行检查.UDP 主要用于与丢失一些数据包无关的事情,例如流媒体、VoIP 等.
Dropped packets are also not resent because no checking is being done at either end. UDP is mostly used for things were loss of a few packets is not that relevant, such as streaming media, VoIP etc.
如果你想要可靠性,那么你需要使用 TCP.
If you want reliability then you need to use TCP.
这篇关于为什么UDP重新排序数据包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!