So what happens if you miss one byte for some reason
You would hit the timeout because you wouldn’t get a multiple of 4 anymore
Now you’ll ask: “What if you missed 4 bytes?”
To which I’ll answer: “Then you’re f****d.”
This was assuming you know the number of bytes in advance. If not, and it is a continous stream, it’s more complicated…
It’s all a matter of circumstances and requirements of course, so it’s impossible to make general statements. If a byte goes missing for some reason, you’ll at least know it and hit the timeout. Maybe the implementation allows requesting the data again, in which case you’ll get a second chance. Maybe not. You could insert a signature byte in between every bunch of 4 (e.g. 0xff), which would allow you to make an educated guess as to what went wrong if something strange is happening.
Many many options, and I still think converting to text is not the best