sockets and signals (in C)
Steve Perryman
skp at stl.stc.co.uk
Fri Aug 10 18:45:16 AEST 1990
Does anyone know of a way to set up a signal handler such that if a flood
of data comes in to a socket, the SIGIO/SIGPOLL (maybe even SIGURG) signal
can invoke a handler fast enough such that a variable can be incremented to
represent the correct number of data items at the socket.
The signal handler will be :
void catch()
{
signal(SIGIO,catch) ;
count++ ;
...
/* Process the signal */
...
}
I've used fcntl to allow the socket to interrupt :
fcntl(sock,F_SETOWN,getpid()) ;
fcntl(sock,F_SETFL,F_ASYNC) ;
...
...
This works but it can't log the correct number of items received if they come
in as bursts of data (5+ items per burst). Can this timing problem be resolved
using SIGIO , or is another way required ???
skp
More information about the Comp.unix.questions
mailing list