RPC server -- How to detect death of client?

Anund Lie anund at idt.unit.no
Tue Mar 19 03:28:00 AEST 1991


When running Sun RPC over TCP (or other connection-oriented services, for
that matter), how can the server detect that a client process has died?
(More precisely: That no process has the other end of the connection
open.)  

On the socket level, this will be detected by a read() on the socket
returning 0 (end-of-file).  The best thing would be to be able to register
a procedure or in some other way control the action to be performed when
RPC detects EOF on a socket.  (It has to detect EOF anyway and close its
end of the socket, hasn't it?)

The manuals does not mention this, but /usr/include/rpc/svc.h (SunOS 4.1)
defines the operation SVC_STAT().  Presumably the (pointer to) the
transport handle could be saved at the first call from a new client, and
the server periodically SVC_STAT() the set of active handles.  Is this a
reasonable thing to do?  There does not seem to be any guarantee that
transport handles are unique over different RPC calls, so that it is OK to
store them in this way.

Anund Lie
Email: anund at idt.unit.no       (Internet)



More information about the Comp.sys.sun mailing list