使用WMI和C#检测机器是否联机或脱机 [英] detect if machine is online or offline using WMI and C#

查看:328
本文介绍了使用WMI和C#检测机器是否联机或脱机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用vs2008,winxp,在LAN网络与Win2003服务器。



我想要一个应用程序安装在winxp检测win2003机器是否在线或离线,如果离线。<​​/ p>

我有这个引用,任何更多的引用,代码示例和最佳实践。



http://danielvl.blogspot.com/ 2004/06 / how-to-ping-in-c-using.html



http://snipplr.com/view/2157/ping-using-wmi-pingstatus/



http:// dotnoted .wordpress.com / 2005/01/15 / the-popular-c-ping-utitility /



http://www.visualbasicscript.com/Ping-WMI-amp -NonWMI-Versions-Functions-amp-Simple-Connectivity-Monitor-m42535.aspx

解决方案

对于.NET System.Net.NetworkInformation.Ping ,因为它是非常灵活,你有可能做异步,我发现它比WMI更直观(我有使用这两个和使用WMI只有当我需要从远程机器获取更多的信息,而不仅仅是ping)。但这只是个人意见。


I use vs2008, winxp, in LAN network with Win2003 servers.

I want a application installed in winxp for detect if win2003 machines is online or offline , and if offline when boot it.

I have this references, any more references, code samples and best practices ??

http://danielvl.blogspot.com/2004/06/how-to-ping-in-c-using.html

http://snipplr.com/view/2157/ping-using-wmi-pingstatus/

http://dotnoted.wordpress.com/2005/01/15/the-popular-c-ping-utitility/

http://www.visualbasicscript.com/Ping-WMI-amp-NonWMI-Versions-Functions-amp-Simple-Connectivity-Monitor-m42535.aspx

解决方案

I would go for the .NET System.Net.NetworkInformation.Ping, because it is quite flexible, you have the possibility of doing it asynchronously and I find it more intuitive than WMI (I have used both and use WMI only if I need to get more info from the remote machine than just the ping). But this is just a personal opinion.

这篇关于使用WMI和C#检测机器是否联机或脱机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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