🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1570

sockets and signals (in C)

#1570
From: Steve Perryman
Date: Wed, 08 Aug 1990 13:55
33 lines
1200 bytes
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++ ;
   ...
   ...
}

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 ???



Thanks in advance,

Steven Perryman
(skp@stl.stc.co.uk)
Technical Details
Message-ID: <3292@stl.stc.co.uk>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!ukc!stl!skp

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!ukc!stl!skp
From: skp@stl.stc.co.uk (Steve Perryman )
Newsgroups: comp.std.c
Subject: sockets and signals (in C)
Keywords: sockets signals
Message-ID: <3292@stl.stc.co.uk>
Date: 8 Aug 90 13:55:23 GMT
Sender: news@stl.stc.co.uk
Reply-To: "Steve Perryman " <skp@stl.stc.co.uk>
Organization: STC Technology Limited, London Road, Harlow, Essex, UK
Lines: 33