in reply to Timing out on sysread()

I should think that select() would let you do a time-limited wait for incoming data.

    -- Chip Salzenberg, Free-Floating Agent of Chaos