开发者

Searching for UPnP devices using SSDP

开发者 https://www.devze.com 2023-03-03 12:26 出处:网络
I wa开发者_JS百科nt to search for my media player on the network. Am I right in thinking it is done using SSDP m-search?

I wa开发者_JS百科nt 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?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消