home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.questions:14604 comp.unix.programmer:5657
- Path: sparky!uunet!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.unix.questions,comp.unix.programmer
- Subject: Re: Determining the state of a process on another host
- Date: 11 Dec 1992 20:36:52 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 27
- Message-ID: <1gau54INNndc@early-bird.think.com>
- References: <1992Dec10.154438.13881@dd.dk>
- NNTP-Posting-Host: telecaster.think.com
- Keywords: TCP IP sockets host process kill
-
- In article <1992Dec10.154438.13881@dd.dk> wes@dd.dk (Mads Westermann) writes:
- >I'm currently writing a client-server application that uses BSD
- >sockets to communicate. At certain stages in the processing I
- >want to be able to determine whether the client process is
- >running/alive.
-
- If you're using a stream socket, you can try to write something to it.
- When the client process died, the remote system should have closed the
- connection. If you try to write to a closed connection you should get an
- error (EPIPE, I think).
-
- > If the client is running on the same machine I
- >can just do a kill(..,0), but if the client is running on another
- >machine - what do I do then ?? I have the hostname, the remote pid,
- >the username and the remote tty-name available on the server. Is
- >there any way of doing a remote kill(...,0) ??
-
- You could implement a process_status daemon server that runs on the client
- machine. You send it a pid, it performs the kill(pid,0), and sends the
- result back to you. Should be trivial to write using RPC utilities, or
- even using straight UDP.
-
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-