in reply to Need to empty STDIN
The idea is to read STDIN when there is data available, and otherwise to sleep for a bit, then check select to see if there is more data, sleep, etc.
-Scott