如何查找过程是否正在其他系统中运行 [英] How to find whether a proces is running in another system

查看:82
本文介绍了如何查找过程是否正在其他系统中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的先生,

在我的项目中,我想查找某个进程是否正在网络中的另一台计算机上运行,​​并且如果该进程正在该系统中运行,那么我想获取该计算机的IP地址.所以请帮帮我.


谢谢
Sujith TP

Dear sir,

Here in my project i want to find whether a process is running in another computer in a network and if that process is running in that system then i want to get ip address of that machine. So please help me.


Thanks
Sujith T.P

推荐答案

您可以使用WMI,请参见: ^ ]
You can use WMI, see this : http://msdn.microsoft.com/en-us/library/windows/desktop/aa394599%28v=vs.85%29.aspx[^]


感谢,计算机之间相互隔离,因此您无法侵入远程计算机并获得所需的信息……除非该计算机上的软件与您协作.

也就是说,此方法是在该远程计算机上创建网络Windows服务,该服务应查看感兴趣的进程的状态并根据运行该服务某些客户端的计算机的请求报告此状态.

尝试使用此演练来创建Windows服务: http://msdn.microsoft.com/en-us/library/zt39148a%28v=VS.100%29.aspx [ http://msdn .microsoft.com/en-us/library/system.diagnostics.process.aspx [我如何将byte []发送到另一台PC [ ^ ],
在局域网上与两个Windows应用程序进行通信. [^ ].

—SA
Thanks goodness, computers are majorly isolated from each other, so you cannot intrude into a remote computer and get what you want… unless software on that computer collaborates with you.

That said, the approach to this is creation a network Windows Service on that remote computer which should review the status of the process in interest and report this status on request of your computer where you run some client of this service.

Try to use this walk-through to create a Windows Service: http://msdn.microsoft.com/en-us/library/zt39148a%28v=VS.100%29.aspx[^].



To poll the status of the process use the class System.Diagnostics.Process, see http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx[^].

Alternatively, you can make the process local to the Windows Service reporting process status to be a local user of this Service and actively report changes of its own state to it (report start of work and end of work before termination). This method is much simpler and more reliable, but of course it should be the application you right.

Another good approach is using WMI, please see the solution suggested by Mehdi.

[END EDIT]

Network communication between services on remote computers and you clients could be done on different levels. I tried to overview them in my past solutions:
how i can send byte[] to other pc[^],
Communication b/w two Windows applications on LAN.[^].

—SA


您可以使用System.ServiceProcess.ServiceController类.它曾经代表Windows服务,并允许您连接到正在运行或已停止的服务,对其进行操作或获取有关它的信息.
参考链接:- MSDN- [ServiceController类] [
You can use System.ServiceProcess.ServiceController class. it used to Represents a Windows service and allows you to connect to a running or stopped service, manipulate it, or get information about it.
Reference Link:- MSDN-[ServiceController Class][^]


这篇关于如何查找过程是否正在其他系统中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆