How can a server tell if a client is gone?
James H. Coombs
jhc at m2jhc.uucp
Wed Aug 29 06:33:55 AEST 1990
In article <26DAAE36.74D6 at wilbur.coyote.trw.com> rudoff at mdi.com writes:
>I am writing an application that uses a client-server model. I want the
>server to be able to tell if the client has disappeared unexpectedly.
>
>I have been using RPC for interprocess communication on a Sun3 and Sun4
>running 4.0.3.
I agree that your need is fundamental and that RPC should provide some
direct support.
In the meantime, you can consider the keepalive option on sockets.
Also, if a socket read succeeds with 0 bytes read, you can reasonably
infer that the other end has died. Others have better explanations and
would probably recommend the use of a select(). Finally, if you
attempt a write on a disconnected socket, the SIGPIPE signal will be
raised. I don't know of any straightforward way to apply these
techniques with RPC.
--Jim
More information about the Comp.unix.questions
mailing list