?
Solved

URGENT : How to detect that an exe is still running on a remote machine

Posted on 2003-03-31
3
Medium Priority
?
164 Views
Last Modified: 2013-11-20
Hi,

I have an application that is connected remotely to a database server.

My application calls methods of the db server to get values.

The thing is that i need to know if the remote server is running, because if it does not run, my
application does not crash but it is lost.

So i need to know if the exe to which i am attached is still running, and if it is possible, if it is not in the Not responding state.

Please can you tell me how i can do a thing like this?

Thanks
0
Comment
Question by:FMayis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 8238178
Check out the 'pviewer' sample from MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample98/html/vcsmppviewer.asp). It pretty much resembles the 'PView.exe' that comes with VC++ and does it using the performance counter registry interface.
0
 
LVL 12

Expert Comment

by:williamcampbell
ID: 8241274

  You will have to set up a heartbeat to the server. The best way to do this is to 'Connect' and 'Disconnect' every 60 seconds or so.

  This is as simple as starting a timer

  SetTimer ( 1,  60000);

  and Handling the WM_TIMER messge

  OnTimer ()
  {
      KillTimer ( 1 );
      if ( !Connect ( ...db...  ) )
      {
            AfxMessageBox ( "Server is down!" )
      }
      else
          {
             Disconnect ( ..db... )
             StartTimer (1 ,60000 );
          }
  }

  Code above assumes 1 timer in your system.

  If the server is down Connect will timeout ... it may take a while to timeout. You can setup a thread that timesout in say 20 seconds if the default timeout is too long.


0
 

Author Comment

by:FMayis
ID: 8243482
Hi,
Thanks for both response.
The points will go to jkr.

It is much more what i was looking for.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question