I personally would modify the loop to do the following:
- Read available bytes into the buffer
- Attempt to validate that the buffer has a valid response
- If yes on #2, consume the buffer and exit the loop. Else keep waiting for more data.
If you can perform a blocking read, there is no need to sleep at all. You'll just keep looping until you get a valid frame. Obviously, other error handling may be required.