doug@ridley.coyote.trw.com (Doug Rudoff) (08/29/90)
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. What would be ideal would be an RPC call that tells you if a server's client still exists. In the not too descriptive man page on RPC, I don't see a function that does what I want. I did try having the client register an RPC service, and have the server every so often check to see if it could make a connection to the client's service (and then destroy the connection). This only worked if I used a tcp protocal (using udp, the server thought the client was there all the time, regardless of whether it was really there or not). However, after a couple of successful verifications of the client's presence, the server's call to clnt_create() would lock up in connect(). In reading the man page for connect(), I can't figure out why it would lock up. The problem of determining if a client still exists seems to me to be a common thing that needs to be done. Is there a simple way to do it with ANY type of IPC? Now, I am using RPC, but its underlying basis is sockets, so some help relating to sockets could be useful. Also, the Sun manuals on RPC leave a lot to be desired. Does anyone know of anything more informitive? (My most important question is what happens to a registed service if its process dies?) -- =-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Doug Rudoff Mobile Data International Bothell, WA (206) 487-5937 rudoff@mdi.com, uunet!mdisea!rudoff =-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
jhc@m2jhc.uucp (James H. Coombs) (08/29/90)
In article <26DAAE36.74D6@wilbur.coyote.trw.com> rudoff@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