Re: Find Previous Instance on another computer?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Björn Holmgren (bjohol_at_hotmail.com)
Date: 04/02/04


Date: Fri, 2 Apr 2004 10:07:08 +0200

Martin,

It has been suggested you use some sort of flag (like a file) and you have
also received some ideas on how to deal with flags left active by a
"crashing" application. This is all fine except the application has to have
some sort of common storage location (in your case, the PLC seems to be the
most logical solution). But what if you want to create an application that
doesn't need a common file share, a database, a server component etc?

One solution that has worked perfectly for me, is to use winsock, and have
the application listen for a broadcast or (more ideally) a multicast packet
and respond to the sender. When the application starts, it
broadcasts/multicasts a packet and waits a few seconds for a response. If no
response is received, it's probably safe to assume that there are no other
running instances.

I know you were looking for a simple solution - this isn't exactly simple as
it involves some winsock api programming (at least for multicasting) - but I
thought you might want to know about it anyway.

--
Björn Holmgren
Guide Konsult AB
"Martin" <martinvalley@comcast.net> wrote in message
news:lpvo60hmm3dhvtlej4cji19oahi651r7nn@4ax.com...
> Is there a way to find out if a specific application is currently
> running on another computer?
>
> I use App.PrevInstance in my VB6 program to assure that a second
> instance can't be started on the same computer. I would like to also
> check a second computer for the same reason. The name (and the IP
> address) of the second computer is known and it's on the same LAN (one
> is a backup for the other).
>
> I want to warn the operator that the program is running on EITHER
> computer when he tries to start it on either computer.
>
> How should I do this?


Relevant Pages

  • Re: Strange CListCtrl Sorting problem
    ... I had Sort flag set to ascending in the resource editor. ... >> If the first time I populate the CListCtrl and sort it, ... >> AliR. ...
    (microsoft.public.vc.mfc)
  • Re: OO, I just dont get it.
    ... write a program that can forward sort lines of text from standard ... Now add in a command line option to "sort in reverse". ... tells the algorithm which which item goes first, ... Now add a command line flag to sort numerically. ...
    (comp.object)
  • Re: Strange CListCtrl Sorting problem
    ... I had Sort flag set to ascending in the resource editor. ... > If the first time I populate the CListCtrl and sort it, ... > AliR. ...
    (microsoft.public.vc.mfc)
  • Re: CPU increasing slowly up to 100%
    ... I think you should look for examples of one process waiting for another ... Sometimes people think if this sort of wait is placed in a thread, ... On the topic of deadlocks, and again at the risk of saying the obvious, ... flag and exit on its own. ...
    (comp.lang.java.programmer)
  • RE: Find Previous Instance on another computer?
    ... Flage could be file, db, activex server, etc. biggest ... thing to lookout for is if one system goes down and leaves the flag up you ... | I use App.PrevInstance in my VB6 program to assure that a second ... | check a second computer for the same reason. ...
    (microsoft.public.vb.general.discussion)