[comp.unix.questions] Sockets & SIGIO, under Dynix

wiml@blake.acs.washington.edu (William Lewis) (03/25/90)

   I am writing a program that has to process both keyboard input (in
CBREAK mode) and socket transactions. Much of the time it would
be sitting idle, though, so I wrote the program as a loop:

for(;;)
{
   sigpause(0);
   if( <keyboard data waiting> )  { process keyboard data; }
   if( <socket data waiting> ) { process socket data; }
};

  This works beautifully for the tty input, but it won't wake up when
things arrive on the socket. I have to press a key to get it out of
the sigpause(), after which it processes the keyboard and socket 
info correctly.
  After RTFMing several times, I found a note to the effect that 
fcntl(FASYNC | FNDELAY) to produce a SIGIO only works on ttys, not
on sockets. My question is, is there any way to produce a similar
effect on a socket, or do I have to resort to polling the socket
several times a second to be responsive?

   Any help would be appreciated. Thanks.
 
-- 
JESUS SAVES   |  wiml@blake.acs.washington.edu       Seattle, Washington
but Clones 'R' Us makes backups!  |  47 41' 15" N   122 42' 58" W