in reply to exiting sysread if no input

There are a wide variety of methods for doing this. What follows is a brief rundown of things that may be relevant, with links to further information. Note, a timeout of hundredths of a second probably will not be possible, you are better off with a non-blocking read in that case.

Also, consider getting your hands on the Unix Network Programming series, and Advanced Programming in the Unix Environment, all by W. Richard Stevens. They are excellent books, probably the most valuable in my library.