C prg: peeking in stdin before getchar or timeout alarm

From: <Bob.Capps_at_pscmail.ps.net>
Date: Thu, 27 Mar 1997 12:36:00 -0600

     We have a process which communicates to dialin terminals which is
     expecting things to behave in an orderly fashion: Connect, tell me
     what you want to do, are you done, goodbye. The trouble is, things
     don't always behave over various local phone lines. We constantly
     "hang" our process while it waits for more input from the dialin
     terminal. Does anyone have any code fragments to provide either of
     the following:
     
     1) a way to "peek" into stdin before we call getchar to see if there
     is anything to get and timeout after a certain period of time.
     
     2) a way to set up a timer so that if we don't get out of getchar
     before a certain period of time has elapsed, we exit out of the
     program.
     
     Thanks!
     
     Bob Capps
     bob.capps_at_ps.net
Received on Thu Mar 27 1997 - 19:16:39 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:36 NZDT