I'm glad you appreciated my help, but I think we've come to a point where we just repeat ourselves.
Either you understand how to properly receive serial bytes, or you'll keep trying to debug the unfixable. I suggest you do a google search about exactly how serial transmission works, at the lowest level. You might eventually convince yourself that serial transmission speed doesn't increase if the receiver calls read() a million times per second...
Good luck.
PS: if (a >= BUFSIZE) { a = BUFSIZE; } takes sooooo long... ![]()