Quote:
Originally posted by SuperDanman
Hmm, well what happens if you loose one of those 24 bytes... it'll be that your 24th byte will actually be the first byte of the new packet... how does your way protect against this?
|
You won't. PC serial ports use buffers to store data in. Once you begin the read, you will get 26 continuous bytes. On the other hand, if the buffers overflow between read operations, you might loose a byte or two. Even if you do, by some mysterious fluke of Windows, loose a byte from the middle of a 24-byte read, checking for the start of the packet on each loop will make sure it corrects itself.