实时发送和接收数据 [英] Send and receive data in real time

查看:104
本文介绍了实时发送和接收数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我需要一些帮助,我是C ++的完整入门者,我正在尝试为我工作的公司开发一个程序.

我需要两个应用程序,一个主机应用程序和一个服务器应用程序.

加载后,主机需要搜索所有可用的服务器并显示可供选择的列表.然后,它将需要实时向服务器发送数据和从服务器接收数据.

加载后,服务器需要广播其位置,以便主机应用可以找到它.然后,它需要从主机应用程序接收,处理并实时发送回去.

我想让它同时在x32和x64上运行.

我不希望有人为我做所有这一切,因为我想将其用作学习经验,我只需要一些指导即可.如果可能的话,我想使用Skype或MSN进行通信.

谢谢

Hello

I need some help, I am a complete beginner with C++ and I am try to develop a program for the company I work for.

What I need is two applications a host app and a server app.

When loaded the host needs to search for all available servers and show a list to choose from. It will then need to send and receive data to and from the server in real time.

When loaded the server needs to broadcast its location so the host app can locate it. It then needs to receive from the host app, process it and send it back in real time.

I would like to have this run on both x32 and x64.

I do not want someone to do all of this for me as I want to use this as a learning experience I just need some guidance. if possible I would like to use Skype or MSN to communicate.

Thank you

推荐答案

有关一些入门指南::)
为了到达这里,您需要告诉我们您要使用哪种基本的实时系统:
For some starter guidance: :)
In order to get anywhere here you need to tell us what basic kind of a Real Time System you are out for:

  1. 固定



该选择非常重要,因为它会缩小或扩大可用于部署您的解决方案的可用操作系统''.

最好的问候,

-MRB



The choice is very important as it will narrow or widen the available OS'' on which your solution can be deployed.

Best Regards,

-MRB


操作系统是这里的第一个可能的问题...并不是所有的问题都是确定性的...想象一下Windows ...如果您需要实时处理某些内容,则需要操作系统开始进行碎片整理或启动另一个可能需要大量资源的应用程序,这可能会减少可用于您的应用程序的资源池...

即,想象一个应用程序使用计算机控制倒立摆...您突然在A:单元中放入了一张软盘并开始向其中写入信息...摆摆可能会掉落...

根据您的实时"的实际需求,您会没事的...如果没有,那么您可能会遇到很大的问题...

您必须确定处理数据的方式:

-始终获取所有信息.
-允许程序拒绝某些数据包,因为它们超出了接收的好时机...
...

给我们更多细节,我们将扩展我们的答案...

无论如何...祝这个初学者"项目好运……
The OS is the first possible problem here... not all of them are deterministic... imagine Windows... if you need to process something in real time and the OS starts defragmenting or you launch another application that could need a lot of resources that could reduce the resource pool available for your application...

i.e. Imagine an app to control an inverse pendulum using a computer... and that you suddenly put a floppy disk in the A: unit and start writing information into it... probably the pendulum will fall...

Depending on the real needs of your "real time" you will be fine... if not... you can be in a really big problem...

You will have to determine the way you need to process the data:

- getting all the information always.
- allowing the program to reject some packets as they are out of the good time to be received...
...

Give us more details and we will extend our answer...

Anyway... good luck with that "beginner" project...


除了曼弗雷德的回答:这是实时的一些基本解释.

硬实时系统是可以预先找到某些时间紧迫响应的最大等待时间的系统,并且系统必须保证在此时间范围内完成响应的可能性为100%.从原则上讲,这很难实现.这不是一定的时间本身,而是关于及时响应的保证.

在一种典型的情况下,牺牲了吞吐量的一部分来保证.硬实时的整体思想始终与某些硬件的控制以及由硬件中断驱动的处理有关.

如果通常考虑Windows,您将了解硬实时属性与Windows无关.即使您为Windows线程/进程应用了实时优先级,它也不能保证某些可预测的延迟,因为该延迟将取决于系统的当前运行状态(其他优先级线程或多或少忙于缓存的状态)所有级别(重要的限制因素!)之类的东西.如果涉及以太网(排除绝对不确定的Internet),它总是会带来无限延迟的可能性,因为冲突解决方案的以太网体系结构完全基于从理论上讲,通过调度和限制所有播放器以避免冲突,可以保证具有固定播放器数量的网络的某些较慢的硬实时网络传输;它应该基于单个中央仲裁器设备.

硬实时领域之外的所有事物都称为软实时或类似的东西.我不确定是否存在非硬实时系统的公认且有效的分类.
请参见 http://en.wikipedia.org/wiki/Real-time_computing [ http://en.wikipedia.org/wiki/Real-time_operating_system [
—SA
In addition to the answer by Manfred: this is some basic explanation of real time.

Hard real time system is the system where the maximum latency of some time-critical response can be found in advance, and the system must guarantee 100% probability of completion of the response in this time frame. This is pretty hard to achieve in principle. This is not about certain time itself, this is about the guarantee of response in time.

In one typical scenario, some part of throughput is sacrificed to the guarantee. The whole idea of hard real time is always related to the control of some hardware and processing driven by a hardware interrupt.

If you think about Windows in general you will understand that the hard real-time properties have nothing to do with Windows. Even if you apply real-time priority for a Windows thread/process, it won''t guarantee certain predictable latency as this latency will depend on current operational status of the system (more or less busy with other priority threads, status of the cache of all levels (important limiting factor!) and stuff like that. If Ethernet is involved (set aside absolutely non-deterministic Internet), it''s always introduces some probability of unlimited delays, as Ethernet architecture of resolution of clashes is totally based on a non-deterministic algorithm. Theoretically speaking, its possible to guarantee some slower hard real-time networking for a network with fixed number of players by scheduling and throttling all players in order to avoid conflicts; it should be based on some single central arbitrator device.

Everything outside the realm of hard real time is called soft real-time or something like that. I''m not sure if there is a commonly accepted and valid classification of not hard real time systems.
See http://en.wikipedia.org/wiki/Real-time_computing[^] and http://en.wikipedia.org/wiki/Real-time_operating_system[^].

Sometimes people call real-time something very specific. For example, there is a common term "real-time" applied to some important sub-system, such as related to multimedia. Needless to say that a media player, for example, should guarantee the fixed audio tempo and/or fixed frame rate. In this sense, it is really a hard real-time subsystem but— until the user does something active and CPU time consuming in parallel. In real life that video may start stalling. This is kind a real time but not of the true kind. True hard real time is used it military, transport systems and the like.

—SA


这篇关于实时发送和接收数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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