简体   繁体   English

实时数据流到多个客户端

[英]Real-Time Data Streaming to Multiple Clients

I would like to write an application which will stream data at 2400 baud over the internet from a server to multiple clients. 我想编写一个应用程序,该应用程序将通过Internet以2400波特的速度将数据从服务器传输到多个客户端。 The data will be the same for each client, and it would probably be fine to send it as a UDP stream, since exact data accuracy is not a 100% necessity, as there are checksums built-in to the data format and the data will be sent repeatedly on a loop. 每个客户端的数据都是相同的,并且可以将其作为UDP流发送,因为精确的数据精度不是100%的必要,因为数据格式内置了校验和,因此数据可能会很好。循环重复发送。

What is the best way to do this? 做这个的最好方式是什么? I would want to write the server in C, but I don't know how to best multicast this data to the different clients that would be receiving it all over the country. 我想用C语言编写服务器,但是我不知道如何最好地将此数据多播到将要在全国范围内接收的不同客户端。

I'm sure this seems like a pretty draconian way to go about my project, as opposed to just using some sort of fetch command, but I'd prefer to do it this way if possible. 我敢肯定,这似乎是执行我的项目的一种严厉的方法,而不是仅仅使用某种fetch命令,但是我更愿意这样做。

You may wish to take a look at unicast for this, particularly if your clients are on multiple directories. 您可能希望对此进行单播研究,特别是如果您的客户端位于多个目录中时。 You should be able to send TCP or UDP traffic out with your data to each of your clients, particularly if bandwidth needs are small. 您应该能够将TCP或UDP流量与数据一起发送到每个客户端,尤其是在带宽需求较小的情况下。 IP multicast works best to groups of nodes on networks near each other. IP多点广播最适用于彼此靠近的网络上的节点组。

Loop over client addresses repeatedly, and send your data. 反复循环访问客户地址,然后发送数据。 Moderate the rate at which you loop to limit the data rate. 调节循环速率以限制数据速率。

Pay attention to the reliability issue: correctness is not the only problem with UDP; 注意可靠性问题:UDP并不是唯一的正确性问题。 you also have no acknowledgment that your data was received, and no guarantee on ordering. 您也不会确认已收到您的数据,也无法保证订购。

Baud doesn't really apply here, as the data is segmented into more or less discrete chunks. 波特实际上并不适用于此,因为数据被分成或多或少的离散块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM