Is there a reason, that peek() is implemented with return 0 ? a simple implementation would be return rxHead == rxTail ? -1 : rxBuffer[rxTail]; or have i overseen something ?