如何避免使用并发 UDP 服务器丢包 [英] How to avoid dropped packets with concurrent UDP server

查看:35
本文介绍了如何避免使用并发 UDP 服务器丢包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是引发此问题的原始链接.

因此,显然 DataGramSocket 不会对接收到的数据包进行排队.因此,如果两个系统同时发送,其中一个数据包将丢失(使用链接中的代码).在这种情况下,我正在寻找避免丢包的方法.

So, apparently DataGramSocket will not queue received packets. So if two systems send concurrently, one of the packets will get lost (using the code from the link). I'm looking for ways to avoid dropping packets in this case.

推荐答案

有队列,但它们总是有限的,你总是可以达到极限.没有办法完全避免这样的问题.您可以通过降低服务器负载来最大程度地减少影响,以便快速排空队列,并为 UDP 流量提供专用网络.

There are queues but they are always limited and you can always reach the limit. There is no way to avoid such issue completely. You can minimise the impact by having a low load on your servers so it can drain the queues quickly, and a dedicated network for UDP traffic.

通常,您必须为丢失的数据包设置一些容限,并且必须使协议可靠.

Generally you have to build in some allowance for lost packets and you have to make the protocol reliable.

这篇关于如何避免使用并发 UDP 服务器丢包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆