Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!prls!pyramid!micropro!ptsfa!root From: root@ptsfa.UUCP (Admin) Newsgroups: net.unix-wizards Subject: Re: Checking for waiting characters Message-ID: <1293@ptsfa.UUCP> Date: Mon, 5-May-86 21:48:20 EDT Article-I.D.: ptsfa.1293 Posted: Mon May 5 21:48:20 1986 Date-Received: Thu, 8-May-86 07:27:43 EDT References: <470@brl-smoke.ARPA> Reply-To: root@ptsfa.UUCP (Admin) Organization: Pacific * Bell, San Francisco Lines: 19 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. Every read I've done seems to wait for characters. >To date, I've tried setting -icanon on standard in, I've set the EOL >value to 50, which according to the documentation should give me a time >out of 5 seconds, and I've set the O_NDELAY on a fcntl() to standard >input. Any help or suggestions would be greatly appreciated. When in raw (c_lflag & ~ICANON) mode the MIN and TIME (EOF and EOL, respectively) you can set both the minimum number of characters to wait for AND the maximum time to wait AFTER the first character arrives. There were problems with this prior to SVR2 which once were described as a documentation bug, but they work now. Couple these with O_NDELAY and you can do what you want.