使用 SSDP 搜索 UPnP 设备
我想在网络上搜索我的媒体播放器。我认为它是使用 SSDP m-search 完成的,对吗?
另外,当我打开设备时,它会广播其可用性吗?我该如何收听该广播,以及如何发送移动搜索查询?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的。
是的
您需要绑定到 UDP 多播组
239.255.255.250:1900
。M-SEARCH
查询被发送到同一地址。Yes.
Yes
You need to bind to the UDP multicast group
239.255.255.250:1900
. TheM-SEARCH
query is sent to the same address.两个都。
一般来说,UPnP 设备会不时地通过 NOTIFY 消息通告自己。
同时,其他设备可以广播 M-SEARCH 消息来询问网络上的本地设备是否满足其查询,如果满足,将/应该导致这些设备再次重新通告自己。
所以是的...您可以通过 M-SEARCH 消息搜索您的媒体播放器,寻找 urn:schemas-upnp-org:device:MediaRenderer:1
至于如何发送 M-SEARCH 查询... UDP 多播是 SSDP 使用的协议,因此通过该协议发送广播消息取决于语言和类型。您正在使用的库。
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.