Sockets & SIGIO, under Dynix (Sequent) ... or 4.3BSD

William Lewis wiml at blake.acs.washington.edu
Sun Mar 25 11:55:03 AEST 1990


   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 at blake.acs.washington.edu       Seattle, Washington
but Clones 'R' Us makes backups!  |  47 41' 15" N   122 42' 58" W



More information about the Comp.unix.questions mailing list