I have an application (Network Time Protocol) that wants to
receive a signal (SIGIO or its equivalent) every time a packet
arrives on a socket. I've tried
ioctl( fd, FIONBIO, ( char *) &on)
to make the system calls non-blocking, and
ioctl( fd, FIOASYNC, ( char *) &on)
int on = 1;
to do the asynchronous part, but SIGIO doesn't seem to be generated.
NTP sends UDP packets, sets a timer (SIGALRM), and
waits for either SIGIO or SIGALRM.
I know SIGALRM works because I wrote a small program to test it
and NTP generates five out-going packets before quitting.
But it looks like the socket isn't generating SIGIO. I see the
return packets on the network with a net analyzer, but the program
never gets to the SIGIO handling routine (I put a print statement
I've looked through the linux fcntl and ioctl code, and through
the net/socket.c and the net/inet/sock.c code, but can't figure
this out. Any help would be greatly appreciated. Can anyone
explain this to me?
I'm using linux-0.99.10 and net-2 (net-010). Generally, net-2 works
on this system. I have minor problems with rlogin, rsh, ftpd, etc.,
but telnet, ftp, nntp, smtp, seem to work well.
Thanks in advance.