Custom data transmission protocol

1. Format

Starter Edition

Header - Length - Data xx xx - Calibration - end of frame

Complicated version

Header, address information, data type, data length, data block, checksum, end of frame

 

The following article for reference: Original link: https: //blog.csdn.net/fangye945a/article/details/84728798

 

When data transmission, packet loss is always present, subcontractors, erroneous packets. To solve this problem, it must introduce a data communication protocol to ensure the integrity and accuracy of the data.

        Typically, for a packet loss, packet error problem will adopt the way check code and the data length to determine the accuracy of alignment of a data packet. For sub-problem, the use of packet header, packet tail fashion (i.e., using a specific value as the two start and end of a data packet a flag), but the use of this method to ensure that the data will not be marked there the packet header, the same characters at the end, which in turn related to the data escape.

        As a simple data communication protocol own summary, the serial port can be used, and other communication networks, for your reference.

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/xiaokangkp0602/p/12448098.html