如何获得“型号名称"用于联网设备(可能使用Bonjour)? [英] How do I obtain "model name" for a networked device (potentially using Bonjour)?

查看:125
本文介绍了如何获得“型号名称"用于联网设备(可能使用Bonjour)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apple的Finder.app能够始终确定使用bonjour的每台物理计算机的确切型号(如每种单独的设备类型(iMac,MacPro,MBP等)所具有的唯一图标所示).他们如何做到这一点以及使用什么API?

Apple's Finder.app is able to consistently determine the exact model of each physical computer that uses bonjour (as evidenced by the icons being unique for each individual device type: iMac, MacPro, MBP, etc). How do they do this and what APIs do they use?

顺便提一句,Bonjour为网络上的所有服务提供了名称,服务类型,域和端口-但我无法找到有关如何查找设备模型本身的信息.

On a side note, Bonjour provides Name, Service Type, Domain and Port for all services on the network - but I haven't been able to find information on how to find the device model itself.

推荐答案

我相信它使用了_device-info._tcp. IP地址的mDNS记录.您可以自己查看.在终端中,您可以使用dig @224.0.0.251 -p5353来执行mDNS请求.您可以使用dig @224.0.0.251 -p5353 Foo.local.来解析计算机Foo.local的IP地址.获取该IP并将其重新插入dig @224.0.0.251 -p5353 -x $IP,您应该看到类似以下内容的内容:

I believe this uses the _device-info._tcp. mDNS record for the IP address. You can see this for yourself. In the terminal, you can use dig @224.0.0.251 -p5353 to perform mDNS requests. You can use dig @224.0.0.251 -p5353 Foo.local. to resolve the IP address of the computer Foo.local. Take that IP and plug it back into dig @224.0.0.251 -p5353 -x $IP and you should see something like the following:

> dig @224.0.0.251 -p5353 -x 10.0.1.1
; <<>> DiG 9.6.0-APPLE-P2 <<>> @224.0.0.251 -p5353 -x 10.0.1.1
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22887
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; QUESTION SECTION:
;1.0.0.10.in-addr.arpa.     IN  PTR

;; ANSWER SECTION:
1.0.0.10.in-addr.arpa.  10  IN  PTR Foo.local.

;; ADDITIONAL SECTION:
Foo._device-info._tcp.local. 10 IN TXT  "model=MacBookPro5,3"

;; Query time: 4 msec
;; SERVER: 10.0.0.1#5353(224.0.0.251)
;; WHEN: Mon Nov 29 18:00:23 2010
;; MSG SIZE  rcvd: 131

请注意其他部分.

不幸的是,我不知道如何使用Bonjour API来获取这些信息.

Unfortunately, I don't know how to get at this information using the Bonjour APIs.

编辑:您还可以通过dig @224.0.0.251 -p5353 Foo._device-info._tcp.local. TXT在单个查询中获取此信息.

Edit: You can also get this info in a single query with dig @224.0.0.251 -p5353 Foo._device-info._tcp.local. TXT.

这篇关于如何获得“型号名称"用于联网设备(可能使用Bonjour)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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