At the moment, you are reading while the local receive buffer ( BytesToRead ), however, the best approach is to keep the buffer and offset, and loop until you have what you need , even if it means waiting - i.e. .
byte[] buffer = new byte[125] int offset = 0, toRead = 125; ... int read; while(toRead > 0 && (read = serialPort.Read(buffer, offset, toRead)) > 0) { offset += read; toRead -= read; } if(toRead > 0) throw new EndOfStreamException();
source share