广播如UDP和TCP的可靠性 [英] Broadcast like UDP with the reliability of TCP

查看:303
本文介绍了广播如UDP和TCP的可靠性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作就是在单一网络上运行完全.NET解决方案。当用户更改了系统的,我现在要启动公告,并有其他人听到它,并采取相应的行动。有没有办法,我们就可以播放出这样的消息的方式(如UDP会让你做),同时保持有保证的传递(如TCP)?

I'm working on a .net solution that is run completely inside a single network. When users make a change to the system, I want to launch an announcement and have everyone else hear it and act accordingly. Is there a way that we can broadcast out messages like this (like UDP will let you do) while keeping guaranteed delivery (like TCP)?

这是一个小型网络(30ish客户端)上,如果会有所作为。

This is on a small network (30ish clients), if that would make a difference.

推荐答案

几乎所有的游戏都需要快速反应的特性(以及在较小的程度上,连接属性)的UDP和TCP的可靠性。他们所做的就是他们建立自己的可靠的协议在UDP之上。这给了他们刚刚爆出包徘徊无论和可选使它们可靠,还有的能力。

Almost all games have a need for the fast-reacting properties (and to a lesser extent, the connectionless properties) of UDP and the reliability of TCP. What they do is they build their own reliable protocol on top of UDP. This gives them the ability to just burst packets to whereever and optionally make them reliable, as well.

可靠的分组系统通常是一个简单的重试,直到确认的系统比TCP简单,但也有它超越了TCP能提供方式的协议。

The reliable packet system is usually a simple retry-until-acknowledged system simpler than TCP but there are protocols which go way beyond what TCP can offer.

您的情况听起来很简单。你可能能够使自己干净的解决方案 - 只是让每一个客户发送回一个我听说你响应,并在服务器不断尝试,直到它得到它(或放弃)

Your situation sounds very simple. You'll probably be able to make the cleanest solution yourself - just make every client send back an "I heard you" response and have the server keep trying until it gets it (or gives up).

如果你想要更多的东西,大多数自定义的协议库是用C ++,所以我不知道他们会使用多少是你。不过,在这里我的知识是几年前的 - 也许有些协议已经被移植了现在。嗯... RakNet和ENET是两个C / C ++库,浮现在脑海中。

If you want something more, most custom protocol libraries are in C++, so I am not sure how much use they'll be to you. However, my knowledge here is a few years old - perhaps some protocols have been ported over by now. Hmm... RakNet and enet are two C/C++ libraries that come to mind.

这篇关于广播如UDP和TCP的可靠性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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