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)开发者_如何学Go
- 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?
It appears that SERVER: is a required header -- at least one client I was playing with did not like notifications with no SERVER:
For some crazy reason I had better luck when I set this field to have extra spaces: CACHE-CONTROL: max-age = 900\r\n
精彩评论