Xref: utzoo comp.unix.questions:24505 comp.unix.wizards:23366 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!ucbvax!bloom-beacon!eru!luth!sunic!mcsun!ukc!stl!skp From: skp@stl.stc.co.uk (Steve Perryman ) Newsgroups: comp.unix.questions,comp.unix.wizards Subject: sockets and signals (in C) Message-ID: <3304@stl.stc.co.uk> Date: 10 Aug 90 08:45:16 GMT Sender: news@stl.stc.co.uk Reply-To: "Steve Perryman " Organization: STC Technology Limited, London Road, Harlow, Essex, UK Lines: 32 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