由于套接字缓冲区溢出导致的数据包丢失是否视为网络丢失?
如果主机上的 UDP 数据包因其套接字缓冲区已满而被丢弃,我是否应该将其视为网络丢失?这种区别将帮助我决定是否考虑在应用程序层实现重传,或者增加缓冲区大小。
我被 UDP 困住了,但我的应用程序需要按顺序传输数据包而不会丢失数据包...>_<
If UDP packets are dropped on a host because its socket buffers are full, should I consider that to be network loss? The distinction would help me decide whether to look into implementing retransmission at the application layer, or to increase the buffer size.
I'm stuck with UDP but my application is required to transmit packets in order with no packet loss... >_<
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果数据包在网络堆栈中丢失,那么您可以像考虑网络数据包丢失一样来考虑它。
UDP 不可靠。您可能不会收到所有数据包,并且它们可能会以不同的顺序收到。无论如何,您的应用程序中都需要一种机制来处理这个问题。
If packets are dropped in the network stack, then you could consider it in the same way that you consider network packet loss.
UDP is not reliable. You might not receive all packets, and they might be received in a different order. You'll need a mechanism in your application to cope with this anyway.
UDP 不可靠,因此如果您需要可靠性,则必须自己实现;数据报被丢弃到哪里并不重要,有些数据报会被丢弃,并且最终结果是相同的。
同样,您将获得重复的数据报,并且您将获得与发送数据报时不同的顺序的数据报。
您可能对此问题的答案感兴趣:您做什么当你需要可靠的UDP时使用?
UDP is unreliable so if you need reliability you MUST implement it yourself; it doesn't matter where the datagrams are dropped, some will be dropped and the end result is the same.
Likewise you will get duplicate datagrams and you will get datagrams in a different sequence to when you sent them.
You might be interested in the answers to this question: What do you use when you need reliable UDP?