简体   繁体   English

Qt,TCP / IP通信校验和

[英]Qt, tcp/ip communication checksum

I am writing a data display program where I receive the data through a serial port. 我正在编写一个数据显示程序,该程序通过串行端口接收数据。 The listener is written by others and it is quite complex. 侦听器是由其他人编写的,非常复杂。 Now I need to transfer the received data to another program/pc. 现在,我需要将接收到的数据传输到另一个程序/ pc。 So I am thinking of the standard tcp communication from Qt. 因此,我正在考虑来自Qt的标准TCP通信。 Is there any class that come along with the tcp classes that does job like checksum? 与tcp类一起工作的类是否有像校验和一样的工作? If I am transmitting an array of 10 doubles each time but at high frequency. 如果我要传输的数组每次都是10倍,但频率很高。 How could I write a client that received all the data correctly without writing those complex algorithms to check the validity of received data bytes? 如何编写一个可以正确接收所有数据的客户端,而无需编写那些复杂的算法来检查接收到的数据字节的有效性?

TCP/IP includes these checks as part of the protocol itself. TCP / IP包括这些检查作为协议本身的一部分。 This includes guarantees for data integrity, as well as the correct re-assembly of data (ie it will definitely be in the same order). 这包括对数据完整性的保证,以及对数据的正确重组(即,肯定会以相同的顺序)。 You mentioned that TCP chops the datastream into packets; 您提到TCP将数据流切成数据包。 this is true, but it will re-assemble the packets in the correct order on the receiving end, or request a re-transmission if it needs to do so. 确实如此,但是它将在接收端以正确的顺序重新组合数据包,或者在需要时请求重新传输。 All of this is taken care of by the Qt networking classes. 所有这些都由Qt网络课程解决。

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

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