Search code examples
network-programmingupnpdevice-discovery

UPnP announce goes out, but device is not discovered


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?


Solution

  • It appears that SERVER: is a required header -- at least one client I was playing with did not like notifications with no SERVER: