abs@nbc1.UUCP (Andrew Siegel) (10/16/85)
I'm looking for an elegant way to achieve "timeout-able" data reads from tty's (and sockets, if possible). In other words, to have a call like: c = getc_timed(stream,delay); which would return some kind of recognizable code should the character not be read from the specified stream within the specified delay. (I'd also like some kind of distinct returned value for EOF.) I've done this in both System III and 4.2BSD (using two different methods, both involving use of the SIGALRM signal), but I'd like to know if I'm overlooking some more obvious facility in UNIX. A transportable method would be the best. Can anyone point me in the right direction, or (even better) send me an example of the method you use? Thanks. Andy Siegel NBC Computer Imaging philabs!nbc1!abs