如何检索局域网中活动PC的列表? [英] How to retrieve a list of active PCs in a LAN?

查看:84
本文介绍了如何检索局域网中活动PC的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在代码项目中有一些有关此的文章,
但是,当我尝试下载并研究源代码时,
链接断开了!
有什么建议吗?

如果可能的话,我想尝试开发一个可以扫描网络并列出网络中所有活动PC的系统〜

问题:为了达到要求,我应该了解/研究什么? (扫描并列出网络)

There are some article in code project talk about this,
however when i try to download and study the source code,
the link is broken!
Is there any suggestion?

If possible , i would like to try on developing a system that can scan the network and list out all the active PC within the network~

Question: what shall i know/study in order to achieve the requirement? (scan and list out the network)

推荐答案

此处是Sacha Barber的文章,该文章具有有效的链接:

使用C#检索网络计算机名称列表 [ ^ ]

基本上,如果您想自己动手制作,我建议您首先找到您的网络IP地址和子网.这将告诉您网络上其他设备可能拥有的IP地址.然后,您可以ping每一个,以确定它们是否响应.在可以ping的那些计算机上,执行WMI呼叫以询问其名称.如果他们回答,请记录该信息.您现在有了一个基本的网络扫描器.
Here is an article by Sacha Barber that has a working link:

Retreiving a list of network computer names using C#[^]

Basically, if you want to roll your own, I would recommend you first find your network IP address and Subnet. This will tell you what possible IP addresses other devices on the network have. Then you can ping each one to determine if they respond. On those that ping, do a WMI call to ask what their name is. If they respond, record that information. You now have a rudimentary network scanner.


此功能比您想做的要多(它也可以检索MAC地址),但是它确实可以检索LAN上的IP地址-将它们转换为IP地址.名称非常简单:检索LAN的IP和MAC地址 [ ^ ]

This does more than you want (it retrieves the MAC address as well) but it does retrieve the IP addresses on the LAN - to convert them to the name is pretty simple: Retrieving IP and MAC addresses for a LAN[^]

System.Net.IPHostEntry he = System.Net.Dns.GetHostByAddress("192.168.0.10");
Console.WriteLine(he.HostName);


这篇关于如何检索局域网中活动PC的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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