Why is NOTIFY necessary in SSDP?
Asked Answered
S

1

7

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?

Scrivens answered 15/6, 2013 at 16:37 Comment(0)
C
17

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).

Calvary answered 16/6, 2013 at 19:45 Comment(2)
+1. Also, periodic NOTIFYs allow control points to infer that a device has left the network, even if that device was unable to send BYEBYEsSemblance
So, instead of clients flooding the LAN by periodically polling M-SEARCH, we have routers and such flooding the LAN with periodic NOTIFY. Seems the net gain is none.Morbific

© 2022 - 2024 — McMap. All rights reserved.