[comp.unix.questions] Signal handling in server-client model

cs222056@cs.brown.edu (Muru Palaniappan) (05/05/90)

I have a simple server-client model with a TCP stream connection on the
internet domain. Both the server and client read from and write to the other
synchronously.

If the server or the client terminates unexpectedly (terminal interrupt
etc.), how can the other sense this and return to its regular processing
loop (ignoring read/write to the sock) instead of terminating (due to a SIGPIPE
signal).

Please reply by e-mail to muru@iris.brown.edu

Thanks.

brnstnd@stealth.acf.nyu.edu (05/05/90)

In article <38863@brunix.UUCP> cs222056@cs.brown.edu (Muru Palaniappan) writes:
  [ client-server, TCP stream connection ]
> If the server or the client terminates unexpectedly (terminal interrupt
> etc.), how can the other sense this

It should receive an EOF---i.e., select() reports that the socket is
readable, and read() returns 0. Or you could dodge the issue until you
get a SIGPIPE.

---Dan