Path: utzoo!attcan!uunet!zaphod.mps.ohio-state.edu!usc!rutgers!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.unix.questions Subject: Re: How do you trap 1/2 a tcp connection dying ? Message-ID: <12323:Nov603:18:1990@kramden.acf.nyu.edu> Date: 6 Nov 90 03:18:19 GMT References: <2088@aber-cs.UUCP> <27457@mimsy.umd.edu> Organization: IR Lines: 19 In article <27457@mimsy.umd.edu> chris@mimsy.umd.edu (Chris Torek) writes: > In article <2088@aber-cs.UUCP> aem@aber-cs.UUCP (Alec D.E. Muffett) writes: > >... if the client ups and dies (kill -9, untrapped SEGV, etc) without > >telling the server it's gonna die, when the client vanishes the server > >goes berserk setting a permament 'read condition' [from select()] on > >that particular fd and it recv()'s the last block of data sent to that fd > >over and over again, once for each iteration of the for loop. > Wanna bet? :-) I think what Chris means is ``Gaaargh! Hasn't anyone told you that I/O system calls don't necessarily return the full amount of data you asked for? That you *have* to check their return values? You're probably checking the recv() against -1 while it's returning 0! Of course it doesn't bother to wipe out the last block of data, which you blithely assume has been read anew!'' but he is, as usual, too polite to say so. :-) ---Dan