🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer.misc
Article #218

How to Detect Termination of Remote Process?

#218
From: Keith Bennett
Date: Fri, 12 Aug 1994 17:59
33 lines
2433 bytes
I have an app running which consists of, among other things, multiple
program pairs, each consisting of 1 instance of a server process
(let's call it S) and a client process (C).  All the S processes run
on the LAN Server server.  One of the C processes runs on the server
machine, and the others on their own client PC.

Within S, I need to know if C is still alive or has died.  What would
be the best way to do this?  These processes communicate via named
pipes.  My understanding was that when the client process dies, the
pipe connecting it is broken.  So I did a loop where I would check
the return value from DosPeekNPipe() and sleep for n seconds.  When
it returned ERROR_BROKEN_PIPE, I assumed that the client process has
died.

This worked fine until I tested the client/server pair that both
resided on the server.  DosPeekNPipe() continued to return 0 even
after the client process was gone.

Can anyone tell me why this happened and if there is a better way to
do what I am doing?

The server program can detect whether or not its client partner is
local.  Perhaps I could use an event semaphore for a local client and
continue to use the pipe for remote clients.  However, I would like
to keep it clean and figure out why the pipe isn't working locally.

Any feedback greatly appreciated.
- Keith
-- 
--------------------------------------------------------------------------
Keith Bennett                            Bennett Business Solutions, Inc.
C++/C Software Development               1852 Middlebridge Drive
kbennett@cpcug.org                       Silver Spring, MD USA 20906
Technical Details
Message-ID: <32gdag$8bt@cpcug.org>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!hookup!swrinde!gatech!newsxfer.itd.umich.edu!zip.eecs.umich.edu!yeshua.marcam.com!MathWorks.Com!uhog.mit.edu!news.intercon.com!news1.digex.net!digex.net!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cd94,cfb3cd5751ed4d01,start
X-Google-Attributes: gid10cd94,public
X-Google-Thread: 11307a,cfb3cd5751ed4d01,start
X-Google-Attributes: gid11307a,public
X-Google-ArrivalTime: 1994-08-12 13:17:40 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!hookup!swrinde!gatech!newsxfer.itd.umich.edu!zip.eecs.umich.edu!yeshua.marcam.com!MathWorks.Com!uhog.mit.edu!news.intercon.com!news1.digex.net!digex.net!not-for-mail
From: kbennett@cpcug.org (Keith Bennett)
Newsgroups: comp.os.os2.programmer.misc,bit.listserv.os2-l
Subject: How to Detect Termination of Remote Process?
Date: 12 Aug 1994 13:59:44 -0400
Organization: Express Access Online Communications USA: 800-969-9090
Lines: 33
Message-ID: <32gdag$8bt@cpcug.org>
NNTP-Posting-Host: cpcug.org