reading serial data with timeouts

You need to use the same technique as the 'Blink without delay' example.

Before you start checking if a characetr is available on the serial port, you store the current value of millis(). You then loop waiting for a character until either a character arrives or the new current millis() value is bigger than the timeout.