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

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

问题描述

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

请针对每个答复讨论一种协议,如果其他人已经提到您使用的协议,则可以考虑将其投票,并在需要时使用评论进行详细说明.

我对这里的各种选项感兴趣,其中TCP处于规模的一端,而UDP处于另一端.有各种可靠的UDP选项可用,每个选项都将TCP的某些元素引入UDP.

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

为避免产生疑问,没有更多的信息,这是一个假设性的问题,我希望能引出一系列答复,详细说明需要做出决定的人可以使用的各种选择和选择.

解决方案

如果没有有关问题领域的其他信息,很难回答这个问题. 例如,您正在使用多少数据?多常?数据的本质是什么? (例如,它是唯一的,一次性的数据吗?还是样本数据流?等) 您正在开发什么平台? (例如,台式机/服务器/嵌入式) 要确定太慢"是什么意思,您使用的是哪种网络介质?

但是,用(非常!)笼统地说,除非您可以对要发送的数据做出一些硬性假设,否则我将必须非常努力地击败tcp以提高速度. >

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

但是,如果您不能容忍单个数据包的丢失,那么您将不得不开始介绍tcp已经具备的可靠性技术类型.而且,在没有进行大量工作的情况下,您可能会发现,您已经开始将这些元素构建到用户空间解决方案中,并且解决了所有固有的速度问题.

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.

I'm interested in the various options here, of which TCP is at one end of the scale and UDP is at the other. Various reliable UDP options are available and each brings some elements of TCP to 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?

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.

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)

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天全站免登陆