当您需要可靠的 UDP 时,您使用什么? [英] What do you use when you need reliable UDP?

查看:39
本文介绍了当您需要可靠的 UDP 时,您使用什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您遇到 TCP 连接可能太慢而 UDP连接"可能太不可靠的情况,您使用什么?市面上有各种标准的可靠UDP协议,您对它们有什么经验?

If you have a situation where a TCP connection is potentially too slow and a UDP 'connection' is potentially too unreliable what do you use? There are various standard reliable UDP protocols out there, what experiences do you have with them?

请在每个回复中讨论一个协议,如果其他人已经提到了您使用的协议,请考虑投票并在需要时使用评论进行详细说明.

Please discuss one protocol per reply and if someone else has already mentioned the one you use then consider voting them up and using a comment to elaborate if required.

我对这里的各种选项很感兴趣,其中 TCP 位于天平的一端,UDP 位于另一端.有多种可靠的 UDP 选项可用,每个选项都为 UDP 带来了一些 TCP 元素.

我知道 TCP 通常是正确的选择,但列出替代方案通常有助于得出该结论.像 Enet、RUDP 等基于 UDP 构建的东西各有利弊,您使用过它们吗,您的经验是什么?

I know that often TCP is the correct choice but having a list of the alternatives is often useful in helping one come to that conclusion. Things like Enet, RUDP, etc that are built on UDP have various pros and cons, have you used them, what are your experiences?

为免生疑问,这里没有更多信息,这是一个假设性问题,我希望可以引出一份回答列表,详细说明需要做出决定的人可用的各种选项和替代方案.

For the avoidance of doubt there is no more information, this is a hypothetical question and one that I hoped would elicit a list of responses that detailed the various options and alternatives available to someone who needs to make a decision.

推荐答案

如果没有关于问题领域的一些额外信息,很难回答这个问题.例如,您使用的数据量是多少?多常?数据的本质是什么?(例如,它是唯一的、一次性的数据吗?或者它是一个样本数据流?等等)你在开发什么平台?(例如桌面/服务器/嵌入式)要确定您所说的太慢"是什么意思,您使用的是什么网络介质?

It's difficult to answer this question without some additional information on the domain of the problem. For example, what volume of data are you using? How often? What is the nature of the data? (eg. is it unique, one off data? Or is it a stream of sample data? etc.) What platform are you developing for? (eg. desktop/server/embedded) To determine what you mean by "too slow", what network medium are you using?

但在(非常!)一般意义上,我认为您将不得不非常努力地尝试在速度上击败 tcp,除非您可以对要发送的数据做出一些艰难的假设.

But in (very!) general terms I think you're going to have to try really hard to beat tcp for speed, unless you can make some hard assumptions about the data that you're trying to send.

例如,如果您尝试发送的数据可以容忍单个数据包的丢失(例如,定期采样的数据,其采样率比信号带宽高很多倍),那么您可能会通过确保可以检测到数据损坏(例如,通过使用良好的 crc)来牺牲一些传输的可靠性

For example, if the data that you're trying to send is such that you can tolerate the loss of a single packet (eg. regularly sampled data where the sampling rate is many times higher than the bandwidth of the signal) then you can probably sacrifice some reliability of transmission by ensuring that you can detect data corruption (eg. through the use of a good crc)

但是如果您不能容忍单个数据包的丢失,那么您将不得不开始引入 tcp 已经拥有的可靠性技术类型.而且,无需投入合理的工作量,您可能会发现您开始将这些元素构建到用户空间解决方案中,同时解决所有固有的速度问题.

But if you cannot tolerate the loss of a single packet, then you're going to have to start introducing the types of techniques for reliability that tcp already has. And, without putting in a reasonable amount of work, you may find that you're starting to build those elements into a user-space solution with all of the inherent speed issues to go with it.

这篇关于当您需要可靠的 UDP 时,您使用什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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