如何根据 IP 地址范围仅获取 LAN 上的计算机?

发布于 2024-10-20 04:28:13 字数 183 浏览 5 评论 0原文

我正在编写一个 C# Winforms 程序,以根据给定的 IP 地址范围获取连接到我的 LAN 的所有计算机。

我正在使用 Ping 类来识别计算机。 但这里的问题是我收到来自连接到 LAN 的所有设备(例如打印机、IP 电话等)的响应。

请帮助我过滤这些设备并仅获取来自 LAN 的计算机。

I am writing a C# Winforms program to get all the computers that are connected to my LAN, based on the given IP address range.

I am using the Ping class to identify the computers.
But the problem here is I am getting responses from all the devices like (printer, IP phone, etc) that are connected to LAN.

Please help me in filtering these devices and to get only computers from LAN.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

归属感 2024-10-27 04:28:13

使用 PING 无法判断网络节点是否为计算机/打印机/IP 电话等。

您需要使用更高级别的协议(如 NETBIOS 或 DNS)来解决此问题,但这在很大程度上取决于设备的实现方式。

It's impossible to tell using PING whether a network node is a computer/printer/ip phone etc.

You would need to use a higher level protocol like NETBIOS or DNS to work this out but it depends very much on how the devices are implemented.

人事已非 2024-10-27 04:28:13

好吧,打印机、电话等设备中可能有通用计算机,运行 TCP/IP 堆栈和一些专用服务器软件,因此归结为您对“计算机”的定义......仍然,这听起来比它的价值更麻烦,除非你能识别出只有你认为的计算机才会有的东西,而且所有的计算机都会有。在 Windows 网络上,也许是 SMB,但这可以捕获通过 SMB 公开存储的 NAS。

我认为没有通用的方法可以做你想做的事情。正如 Lloyd 指出的那样,nmap 会进行一些指纹识别,但这远非完美(它通常会非常接近特定的操作系统版本,但它无法判断运行该操作系统的物理设备类型)。

Well, chances are that the printer, phone, etc. have general purpose computers in them running a TCP/IP stack and some specialized server software, so it boils down to what your definition of what a "computer" is... still, it sounds like more trouble than it's worth, unless you can identify something that only what you think of as computers will have, and that all of them will have. On a Windows network, SMB, perhaps - but that could catch a NAS that exposes storage over SMB.

I don't think there's a general way to do what you want to do. Like Lloyd pointed out, nmap does some fingerprinting, but that is far from perfect (it will usually get pretty close to a specific OS version, but it can't tell what kind of physical device is running that OS).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文