JustAnotherNetizen
JustAnotherNetizen

Reputation: 115

Searching for UPnP devices using SSDP

I want to search for my media player on the network. Am I right in thinking it is done using SSDP m-search?

Also, when I switch the device on, will it broadcast its availability? How do I go about listening for that broadcast, and how do I send the m-search query?

Upvotes: 2

Views: 3783

Answers (2)

Matt Joiner
Matt Joiner

Reputation: 118500

I want to search for my media player on the network. Am I right in thinking it is done using SSDP m-search?

Yes.

Also, when I switch the device on, will it broadcast its availability?

Yes

How do I go about listening for that broadcast, and how do I send the m-search query?

You need to bind to the UDP multicast group 239.255.255.250:1900. The M-SEARCH query is sent to the same address.

Upvotes: 3

Brendan Grant
Brendan Grant

Reputation: 1012

Both.

In general, a UPnP device will advertise itself from time to time via a NOTIFY message.

At the same time, other devices can broadcast an M-SEARCH message to ask local devices on the network if they meet it's query, and if so, will/should cause those devices to re-advertise themselves again.

So yes... you could do a search for your media player via an M-SEARCH message, looking for a urn:schemas-upnp-org:device:MediaRenderer:1

As for how you send an M-SEARCH query... UDP multicast is the protocol SSDP uses, so sending a broadcast message via that depends on the language & libraries you are using.

Upvotes: 1

Related Questions