How do you trap 1/2 a tcp connection dying ?

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Tue Nov 6 14:18:19 AEST 1990


In article <27457 at mimsy.umd.edu> chris at mimsy.umd.edu (Chris Torek) writes:
> In article <2088 at aber-cs.UUCP> aem at 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



More information about the Comp.unix.questions mailing list