Hello,
Communication protocols can be divided to several levels. My question here is about the "frame" level.
Most simple protocols consist of some start byte, then data of a fixed length, then a checksum and then an end byte. This is practical, because if some of the bytes get lost, the receiver looks for a start byte again and loses only one frame.
However, consider the freak scenario of the start byte appearing in the data all the time. If one byte of a frame gets lost, the receiver can then incorrectly re-sync on the data as the start of the next frame, and resync on it again and again, as the start byte keeps appearing in the data.
One way to solve this is to make sure start and end bytes never appear in the data. For example, we can define that if some such byte appears, it gets preceded by a special marker byte. This results in variable length messages but solves the problem.
What are other ways to combat these problems ? Any good sources on alternatives for communication on the frame level ?
Thanks in advance, Eli