C#如何检测局域网上的某台计算机是否关机 [英] C# how do I can detect some computer on LAN for shutdown
本文介绍了C#如何检测局域网上的某台计算机是否关机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hi
我需要在C#中使用一些可以检测LAN上任何系统关闭的应用程序。如果通过LAN连接两台计算机,如何在一台计算机的C#中识别另一台系统已关闭。或者一台计算机如何通知其他人正在关闭
谢谢
我尝试了什么:
我曾经尝试过TCP IP但是没有这方面的要求。
Hi
I need to have some application in C# that can detect shutdown of any system on LAN. If two computers are connected through LAN, how is it possible in C# for one computer to identify that the other system has been shutdown. OR how can one computer notify other that it is shutting down
Thanks
What I have tried:
Well I had tried TCP IP but there is no requirement in this regard.
推荐答案
我不知道知道是否有更复杂的方法来做...
但可能是使用常规ping
如果LAN合作伙伴在那里,如果没有超时则有答案。
您将无法使用要知道计算机是否已关闭或LAN电缆已拔下,但这是一个开始。
如果确实需要要知道什么时候关机,那么你可以创建一个在后台运行的小应用程序或服务:
1)app / service监听TCP输入
2)如果窗口关闭,app / service会在退出时向给定的伙伴发送广播TCP电报或具体电报
但是,如果关闭是困难的,你就不会有信号(例如黑掉)
I don't know if there is a more sophisticated way to do it...
but a possibility could be to use a regularping
If the LAN partner is there, there is an answer if not a timeout.
You won't be able to know if the computer was switched down or the LAN cable was unplugged, but it is a start.
If it is really needed to know when shutdown is, then you can created an tiny application or service that run in the background:
1) The app/service listens the TCP input
2) the app/service sends a broadcast TCP Telegram or a concrete telegram to the given partner when exiting if windows is shutdown
But you won't have a signal if the shutdown is a hard one (e.g. black out)
这篇关于C#如何检测局域网上的某台计算机是否关机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文