Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is NOTIFY necessary in SSDP?

I'm hoping somebody can clear up my confusion behind the purposes of NOTIFY and M-SEARCH messages used by upnp/ssdp protocol.

My understanding is that a NOTIFY message is sent when a device wants to advertise itself to other UPNP capable devices and an M-SEARCH message is sent when a device wants to find out about other UPNP capable devices.

So then, if my device received an M-SEARCH message from some other device via broadcast address (for SSDP,239.255.255.250) , I'd respond to it with proper format:

HTTP/1.1 200 OK 
 CACHE-CONTROL: max-age = seconds until advertisement expires
 DATE: when response was generated
 EXT: 
 LOCATION: URL for UPnP description for root device
 SERVER: OS/version UPnP/1.0 product/version
ST: search target
USN: advertisement UUID

Here is my question. Why does NOTIFY message exist in the first place? Since you send the device information back to the requested device upon seeing M-SEARCH, it seems to me that there's no point of advertising the device information in advance with NOTIFY unless if it was asked for, because other devices listening to the advertisement may or may not be available at the time NOTIFY was sent.

In other words, I'd like to know the exact purpose of NOTIFY compared to M-SEARCH, preferably with actual examples of its usage.

Or am I just misunderstanding this protocol entirely?

like image 769
l46kok Avatar asked Jun 15 '13 16:06

l46kok


1 Answers

Example:

  1. A control point joins network
  2. The control point sends M-SEARCH, gets no replies.
  3. A media renderer joins network
  4. The media renderer sends NOTIFY
  5. Control point notices NOTIFY, updates the UI to show the new renderer

Without the NOTIFY control point would have to poll constantly if it wanted to notice new devices as they appeared. Same goes for devices leaving the network (although sometimes devices leave unexpectedly so you can't trust on byebyes to be sent).

like image 54
Jussi Kukkonen Avatar answered Sep 21 '22 07:09

Jussi Kukkonen