The order apprach, check there is input ready to read:
You could use async I/O to read from the handle, such as the ReadFileEx() WIN32 call. Use CancelIo() to terminate reading in the absence of input.
See MSDN at http://msdn.microsoft.com/en-us/library/aa365468(VS.85).aspx