How to set a time out like Serial.setTimeout() for Serial.read()?
You can't set timeout for read(), but you can use readBytes() to read one byte.

byte b;
int count = Serial.readBytes(&amp;b, 1); // read one byte with timeout
if (count) { // 0 or 1
  Serial.write(b); //echo
}