[英]Monitoring clients connected to a network
I have a requirement to monitor the client system connected to a LAN Network. 我需要监视连接到LAN网络的客户端系统。 If a system gets connected to a LAN , i need to get a notification and if a system gets disconnected from LAN, i need to get a notification.
如果系统连接到LAN,我需要获取通知;如果系统与LAN断开连接,则需要获取通知。
Currently i am pinging the systems continuously in a C# code and getting the things done. 目前,我正在用C#代码连续ping系统并完成工作。
Drawbacks :- 缺点 :-
1.I hard coded the system names to ping. 1.我将系统名称硬编码为ping。
2.If the client is not reachable/ not in LAN / Host not found, the ping method waits for a period and throws exception. 2.如果客户端无法访问/不在局域网中/找不到主机,则ping方法将等待一段时间并引发异常。
3.So to to do this in Background, i perform this function in a thread. 3.因此,要在后台执行此操作,我需要在一个线程中执行此功能。
4.Calling that thread inside a timer. 4.在计时器中调用该线程。
What is the best way to achieve this ? 实现此目标的最佳方法是什么?
ESSENCE 本质
Some event , it should notify on new incoming connections,
connection which is getting lost from LAN. This event should run async, monitor
continuously.
I am using Windows Application (WPF) , C#. 我正在使用Windows应用程序(WPF)和C#。
Assuming you don't want to install an agent on all the PCs you want to monitor, the best thing to do would be to follow this process: 假设您不想在要监视的所有PC上安装代理,那么最好的办法就是遵循以下过程:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.