You should not use any blocking routines if you want to get a smooth running and responsive
sketch, so process data when it arrives and don't wait for anything, always just react.
Test with some new data, but please post that data here, maybe there is something
that is not handled correctly, because it did not occur in the current data.
Do you have any documentation for the packets?