Fail to read data from rs232


i work with rs232 and i see that somtimes i failed to read from serial.
in one side (my computer) i am writing data, and in Hydra i am trying to read it.

i see that “read” is not always blocking and can return without read any byte.

code in hydra:

 byte[] tempBuffer = new byte[RESET_WORD_LENGTH];
                rS232.serialPort.WriteLine("Data received");
                readCounter = rS232.serialPort.Read(tempBuffer, 0, tempBuffer.Length);
                if (readCounter == 6 && (tempBuffer[0] == 'r') && (tempBuffer[1] == 'e') && (tempBuffer[2] == 's') && (tempBuffer[3] == 'e'))
                    rS232.serialPort.WriteLine("reset ack");
                // do somthing

            } while (tempBuffer[0] != 's' && tempBuffer[1] != 't' && tempBuffer[2] != 'a' && tempBuffer[3] != 'r' && tempBuffer[4] != 't');

readCounter can return with 0 after 1 sec.
i set the timeout for read to 90000 (90 sec)

probably best to show us a larger portion of your code - explicitly I’d ask to show us the place where you open your serial port and set any related settings