473,387 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

A way for closing an app monitor

Hello,

I'm in the way for creating an application and its monitor. Yes, there
are 2 applications: The main app, and a monitor. The last one monitors
the main application for keeping it alive, and viceversa. But if I
close the main app, I want to close the monitor.

That is very easy under nt systems, but in 98 is a little more tricky
because of the problem with closing processes.

For example, I can't use the following code on a win98 machine:

def FindPID(exename):
"""
usage:
pid=FindPID("pythonw.exe")
print pid
"""
a = os.popen4('tasklist /FI "IMAGENAME eq '+exename+'"')
a[0].flush()
try:
info=a[1].readlines()[3].split()
except:
info=[exename,"NotFound"]
return info[1] #PID

because the "tasklist" command doesn't exist on win98. Also, I tried to
install the kill.exe and a dont-remember-dll (from the Win98 Resource
Kit), but it doesn't work.

So my solution (need help on this) is that I have been thinking on
letting the monitor listen for socket connection. Through this, the
main app can tell him to close when the main app closes correctly. Do
you think this is well thought? Any suggestions?

Daniel

Nov 22 '05 #1
4 1219
//So my solution (need help on this) is that I have been thinking on
letting the monitor listen for socket connection. Through this, the
main app can tell him to close when the main app closes correctly. Do
you think this is well thought? Any suggestions?

This is the only solution you have to consider. If monitor and main
app. run on the same machine - does not matter, But when they run on
different machines and maybe in different domains... One more hint:
make monitor a listener (server), namely HTTP server. In this case you
will not have problems with proxyes/firewalls etc.

Nov 22 '05 #2
//So my solution (need help on this) is that I have been thinking on
letting the monitor listen for socket connection. Through this, the
main app can tell him to close when the main app closes correctly. Do
you think this is well thought? Any suggestions?

This is the only solution you have to consider. If monitor and main
app. run on the same machine - does not matter, But when they run on
different machines and maybe in different domains... One more hint:
make monitor a listener (server), namely HTTP server. In this case you
will not have problems with proxyes/firewalls etc.

Nov 22 '05 #3
Ok. Thanks for your answer :-)

I have implemented this and works correctly.

Daniel

Nov 22 '05 #4
Ok. Thanks for your answer :-)

I have implemented this and works correctly.

Daniel

Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Theo | last post by:
Question for the group The authentication system for the site Im working on seems to function properly and all is good. A session keeps track of everything and a cookie is used to accept or deny...
4
by: bbass | last post by:
thanks to all that replyied to my previous post with the following code in question: <a href="merc.htm" target="_new_merc" onfocusout=window.close class="left_link"> i understand that the...
3
by: fournij | last post by:
Hi I'm writing a MFC C++ application using Visual .NET. I'm using a Dual Head video card with 2 monitors. I want to start my application in the first monitor but open a dialog box in the...
12
by: Perecli Manole | last post by:
I am having some strange thread synchronization problems that require me to better understand the intricacies of Monitor.Wait/Pulse. I have 3 threads. Thread 1 does a Monitor.Wait in a SyncLock...
6
by: alessandro | last post by:
Hi all, This is my framework for create TCP server listening forever on a port and supporting threads: import SocketServer port = 2222 ip = "192.168.0.4"
4
by: =?Utf-8?B?a2F5a28yMDAw?= | last post by:
Hey folks, I'm having a bit of an issue with how Windows Vista (or my ASUS notebook) handles closing my notebook lid. If I have an external monitor (my TV through S-Video) connected to my...
3
by: Lilith | last post by:
Maybe I'm making some assumptions about how threads work. I have a form that, on the press of a button, starts monitoring some SMTP connections. On occasions I make changes while the thread is...
0
by: faisalmushtaq | last post by:
Hi all, i am facing a problem regarding crystal reports.i am working on a software which contains a large number of crystal reports.A user might open a large number of reports having different...
5
by: jbenner | last post by:
I have opened a PMR for this with IBM, and am not asking for advice from the DB2 DBA community. I am posting this as an FYI that DB2 Health Monitor, even at the latest version of DB2, still can cause...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.