Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: net.unix-wizards Subject: Re: Checking for waiting characters Message-ID: <737@brl-smoke.ARPA> Date: Fri, 9-May-86 20:01:59 EDT Article-I.D.: brl-smok.737 Posted: Fri May 9 20:01:59 1986 Date-Received: Sun, 25-May-86 06:29:38 EDT References: <470@brl-smoke.ARPA> <1293@ptsfa.UUCP> <1364@ihuxy.UUCP> Reply-To: gwyn@brl.ARPA Organization: Ballistic Research Lab (BRL) Lines: 17 In article <1364@ihuxy.UUCP> ejbjr@ihuxy.UUCP (Branagon) writes: >> In article <470@brl-smoke.ARPA> KEN%NJITCCCC.BITNET@wiscvm.wisc.edu (Kenneth Ng) writes: >> >On Unix System V version 2 on an AT&T 3b5, has anyone been able to >> >successfully test if characters are pending? I've got an application >> >that needs to time out after a certain amount of time if no characters >> >come through. > >The easiest way I've found to do this is to set an alarm, and use a signal >trapping function (see alarm(2) and signal(2)). The alarm can be set once >at the beginning, or reset after each character. I'm not sure if alarm() >is sysV specific or not. No, alarm() has been in all UNIXes since 6th Edition. However, the alarm signal can mangle I/O involving "slow" devices (typically terminal ports), so it is not suitable for some applications like this. Other approaches such as using MIN,TIME are preferable.