检测所有联网设备家庭网络中的类型
我想编写一个在联网设备(即PC)上运行的软件。它可以自动检测其他网络设备的类型。例如,它可以检测到同一网络中运行有 PS3、Wii、iPad。有什么想法吗?谢谢,
I would like to write a software running in a networked device, i.e. PC. It can automatically detect the other network devices' types. For example, it can detect there is a PS3, a Wii, an IPad running in the same network. Any ideas? Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您遇到两个问题:首先,检测到设备已连接到您的网络并且位于
192.168.1.x
。其次,以某种方式检测该设备是什么。第一个很容易实现:有 UPnP 和 Bonjour 等发现协议。然而,在家庭网络场景中,获取已连接设备列表的最简单、最可靠的方法可能是从路由器中提取 DHCP 保留。您可能必须从路由器基于 HTML 的管理界面中抓取数据(尽管这可能很糟糕),但它会起作用。 (如果您使用 .NET,请考虑使用 HTML Agility Pack 来完成此任务。)
一旦您有了列表的连接设备的 IP 地址,您的下一个问题是弄清楚每个设备实际上是什么。这将更具挑战性。一些可能性:
You have two problems: first, detecting that a device is connected to your network and at
192.168.1.x
. Second, somehow detecting what that device is.The first is easy-ish to accomplish: there's discovery protocols like UPnP and Bonjour. However, in a home networking scenario, the easiest and most reliable way to get a list of connected devices is probably to pull the DHCP reservations from your router. You might have to scrape data from the router's HTML-based management interface—hacky as that may be—but it would work. (If you're using .NET, consider the HTML Agility Pack to accomplish this.)
Once you have a list of IP addresses of connected devices, your next problem is to figure out what each device actually is. This will be more challenging. Some possibilities:
夫妻的想法。广播 IP 地址 - 255.255.255.255 是设备通话并说“我在这里”的地方。应该能够收听此内容并查找 IP 地址等。其次,如果设备由 DHCP 客户端分配了 IP 地址(显然),您通常可以在 dhcp 设备上找到一个列表。设备通常有名称,这是一个更高级别的协议,例如 Windows SMB,您可能必须与之交互才能获取该信息。
Couple thoughts. The broadcast IP address - 255.255.255.255 is where devices talk and say "here I am". Should be able to listen to this and find ip addresses and more. Second, if devices are assigned an IP address by a DHCP client (obviously) you can usually find a list on the dhcp device. Devices often have names, this is a higher level protocol, like windows SMB, that you may have to interface with in order to get that information.