Various versions of UNIX provide a FIONREAD ioctl call which checks for pending input and/or an O_NDELAY flag which can be set by fcntl to provide nonblocking reads. Check your manual to see whether you have either of these. Kenneth Almquist