简体   繁体   English

使用C#UDP从Labview RT实时操作系统接收数据时速度有多快

[英]How fast can be it when using C# UDP to receive data from Labview RT realtime OS

All. 所有。

I am searching for a long time on net. 我正在网上搜索很长时间。 But no use. 但是没用。

I'm encountered a problem,that is in my computer, I use C# UDP receive method to receive data from a Labview RT realtime OS, my computer and the Labview RT realtime OS are connected through a cable. 我遇到了一个问题,那就是在我的计算机中,我使用C#UDP接收方法从Labview RT实时操作系统接收数据,我的计算机和Labview RT实时操作系统通过电缆连接。

When my computer received data from the Labview RT realtime OS, it will display the data in a textbox, one line per received data. 当我的计算机从Labview RT实时操作系统接收数据时,它将在文本框中显示数据,每收到的数据一行。 The data was sent frequently by Labview RT realtime OS, the time gap of sent data packet ranged from 5 milliseconds to 100 milliseconds. Labview RT实时操作系统经常发送数据,发送的数据包的时间间隔介于5毫秒到100毫秒之间。

All worked well when the time gap of sent data packet by the Labview RT realtime OS is greater than 15 milliseconds, one data packet will be displayed per line, but when the time gap is less than 15 milliseconds, the data packet will be displayed together. 当Labview RT实时操作系统发送的数据包的时间间隔大于15毫秒时,每行都将显示一个数据包,而当时间间隔小于15毫秒时,这些数据包将一起显示,这一切都可以正常工作。

I guess this is because the C# udp receives the data not that fast so it treats the data packets which is sent with the time gap less than 15 milliseconds as one packet. 我猜这是因为C#udp接收数据的速度不是那么快,所以它将以小于15毫秒的时间间隔发送的数据包视为一个数据包。

So....How can I solve this problem? 所以....我该如何解决这个问题? (^_^) (^_^)

The short answer is write a "Datagram" checker and split if necessary. 简短的答案是编写一个“数据报”检查器,并在必要时进行拆分。

The program in principle behaves correctly, I think the problem is in the understanding of how data is send over the UPD (and also TCP) protocol and terminology. 该程序原则上可以正常运行,我认为问题在于了解如何通过UPD(以及TCP)协议和术语发送数据。

You have a single set of data you want to sent called Datagram this can be sent whith the UPD transport protocol which uses the IP internet layer for sending the Datagram. 您只有一个要发送的数据集,称为数据报,可以通过使用IP互联网层发送数据报的UPD传输协议来发送。 For this the Datagram might be split up into several Packets . 为此,数据报可以分为几个数据包 These packets will be sent from the host device to the client device. 这些数据包将从主机设备发送到客户端设备。 At the client device the packets will combined to a Datagram and be stored in a buffer until read by the program. 在客户端设备上,数据包将合并为一个数据报,并存储在缓冲区中,直到被程序读取为止。

The C# program seems to either read all available Datagrams in the buffer which might be more than one and display them as one. C#程序似乎要么读取缓冲区中的所有可用数据报(可能不止一个),然后将它们显示为一个。 Or Labview RT might combine your actual data into a single Datagram. 否则Labview RT可能会将您的实际数据合并为一个数据报。 Wherever the problem lies writing a Datagram checker on the client side that can split the packages seems the best option without limiting the transmission speed. 无论问题出在哪里,在客户端编写可以拆分软件包的数据报检查器似乎都是最好的选择,而不限制传输速度。

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

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