UPnP 公告消失,但未发现设备
我正在为 UPnP 设备编写代码以宣布其自身。我对它能够发现网络上的其他 UPnP 设备不感兴趣。我正在发送以下消息(取自wireshark)
NOTIFY * HTTP/1.1\r\n
NT: upnp:rootdevice\r\n
USN: uuid:0000-1111-2222-3333::upnp:rootdevice\r\n
NTS: ssdp:alive\r\n
LOCATION: http://192.168.40.8:80/rdd2.xml\r\n
HOST: 239.255.255.250:1900\r\n
CACHE-CONTROL: max-age=900\r\n
Content-Length: 0\r\n
\r\n
并且
NOTIFY * HTTP/1.1\r\n
NT: urn:schemas-upnp-org:device:BinaryLight:1\r\n
USN: uuid:0000-1111-2222-3333::urn:schemas-upnp-org:device:BinaryLight:1\r\n
NTS: ssdp:alive\r\n
LOCATION: http://192.168.40.8:80/rdd2.xml\r\n
HOST: 239.255.255.250:1900\r\n
CACHE-CONTROL: max-age=900\r\n
Content-Length: 0\r\n
\r\n
并且
NOTIFY * HTTP/1.1\r\n
NT: uuid:0000-1111-2222-3333\r\n
USN: uuid:0000-1111-2222-3333\r\n
NTS: ssdp:alive\r\n
LOCATION: http://192.168.40.8:80/rdd2.xml\r\n
HOST: 239.255.255.250:1900\r\n
CACHE-CONTROL: max-age=900\r\n
Content-Length: 0\r\n
\r\n
该设备不会发现(在Win 7页面上我看到我的其他UPnP设备或在Intel的Device Spy for UPnP Technologies上 - 查看更新)。我有 2 个问题。首先,所有这些消息都是必要的吗?其次,有人能明白为什么我的设备不会被发现吗?
其他信息:
我的 rdd2.xml 设备描述文件
<?xml version="1.0"?>
<root>
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<deviceType>urn:schemas-upnp-org:device:BinaryLight:1</deviceType>
<friendlyName>RFLC</friendlyName>
<manufacturer>Legrand</manufacturer>
<manufacturerURL>http://www.legrand.us/</manufacturerURL>
<modelDescription>Legrand Low Cost RF Lighting Control</modelDescription>
<modelName>X-10L1</modelName>
<modelNumber>L1</modelNumber>
<modelURL>http://www.legrand.us/</modelURL>
<serialNumber>0000001</serialNumber>
<UDN>uuid:0000-1111-2222-3333</UDN>
<UPC>00000-00001</UPC>
<presentationURL>pres.html</presentationURL>
</device>
</root>
以及来自 Wireshark 的一些信息(向下查看一个消息帧列表)
+ Frame .....
+ Ethernet II, Src: _my device_ , Dst: 239.255.255.250
+ Internet Protocol, Src Port: ssdp (1900), Dst Port: ssdp (1900)
- Hypertext Transfer Protocol
_... msgs from above are here..._
更新:我可以在英特尔的 upnp 实用程序上看到该设备。那是一个错误的写法。该设备在调试器下运行,一旦在没有调试器的情况下重新启动,它就会在实用程序中发现。我在 Windows 7 上仍然看不到它?有什么想法吗?
I am writing code for a UPnP device to announce itself. I have no interest in it being able to discover other UPnP devices on the network. I am sending out the following messages (taken from wireshark)
NOTIFY * HTTP/1.1\r\n
NT: upnp:rootdevice\r\n
USN: uuid:0000-1111-2222-3333::upnp:rootdevice\r\n
NTS: ssdp:alive\r\n
LOCATION: http://192.168.40.8:80/rdd2.xml\r\n
HOST: 239.255.255.250:1900\r\n
CACHE-CONTROL: max-age=900\r\n
Content-Length: 0\r\n
\r\n
AND
NOTIFY * HTTP/1.1\r\n
NT: urn:schemas-upnp-org:device:BinaryLight:1\r\n
USN: uuid:0000-1111-2222-3333::urn:schemas-upnp-org:device:BinaryLight:1\r\n
NTS: ssdp:alive\r\n
LOCATION: http://192.168.40.8:80/rdd2.xml\r\n
HOST: 239.255.255.250:1900\r\n
CACHE-CONTROL: max-age=900\r\n
Content-Length: 0\r\n
\r\n
AND
NOTIFY * HTTP/1.1\r\n
NT: uuid:0000-1111-2222-3333\r\n
USN: uuid:0000-1111-2222-3333\r\n
NTS: ssdp:alive\r\n
LOCATION: http://192.168.40.8:80/rdd2.xml\r\n
HOST: 239.255.255.250:1900\r\n
CACHE-CONTROL: max-age=900\r\n
Content-Length: 0\r\n
\r\n
The device will not discover (either on the Win 7 page where I see my other UPnP devices or on Intel's Device Spy for UPnP Technologies -- see update). I have 2 questions. first, are all of these messages necessary? And second, can anyone see why my device would not be discovered?
Other info:
my rdd2.xml
device description file
<?xml version="1.0"?>
<root>
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<deviceType>urn:schemas-upnp-org:device:BinaryLight:1</deviceType>
<friendlyName>RFLC</friendlyName>
<manufacturer>Legrand</manufacturer>
<manufacturerURL>http://www.legrand.us/</manufacturerURL>
<modelDescription>Legrand Low Cost RF Lighting Control</modelDescription>
<modelName>X-10L1</modelName>
<modelNumber>L1</modelNumber>
<modelURL>http://www.legrand.us/</modelURL>
<serialNumber>0000001</serialNumber>
<UDN>uuid:0000-1111-2222-3333</UDN>
<UPC>00000-00001</UPC>
<presentationURL>pres.html</presentationURL>
</device>
</root>
And some info from Wireshark (a view down one msgs frame list)
+ Frame .....
+ Ethernet II, Src: _my device_ , Dst: 239.255.255.250
+ Internet Protocol, Src Port: ssdp (1900), Dst Port: ssdp (1900)
- Hypertext Transfer Protocol
_... msgs from above are here..._
UPDATE: I CAN see the device on intel's upnp utilities. that was a mistake writing that. The device was running under a debugger, and once rebooted with no debugger, it DID discover in the utilities. I still cannot see it on windows 7 though? Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来 SERVER: 是必需的标头 - 至少我正在使用的一个客户端不喜欢没有 SERVER: 的通知:
It appears that SERVER: is a required header -- at least one client I was playing with did not like notifications with no SERVER:
由于某些疯狂的原因,当我将此字段设置为具有额外空格时,我的运气更好:
缓存控制: 最大年龄 = 900\r\n
For some crazy reason I had better luck when I set this field to have extra spaces:
CACHE-CONTROL: max-age = 900\r\n