0

I am writing a upnp application using Cling library. To get my Services/Server I do something like this.

public void searchForServers( ) {

    /*
        do stuff....
     */

    // Search for new devices
    getUpnpService().getControlPoint().search(new UDADeviceTypeHeader( new UDADeviceType("MyFantasticService")));
}

I had expected that the Registry only should contain instances of "MyFantasticService" but it turns out that a lot of different upnp devices seems to answer my call....

Have I misunderstood something here? Seems pretty clear how to do in the manual..

lg.lindstrom
  • 776
  • 1
  • 13
  • 31
  • Just because it is a Standard, don't expect that it is implemented correctly on every device. I've seen horses puke (as we like to say here) with RTSP implementations on cameras ... So if you are sure **you** do everything as you are supposed to do then chances are that devices do not. In that case check again the results and eliminate false positives. You shouldn't trust input of that kind anyway. – Fildor Aug 17 '16 at 08:41
  • Yea,, I was thinking in that direction. – lg.lindstrom Aug 17 '16 at 12:29
  • 2
    Getting _lots_ of different responses indicates a problem on your side though. As with everything UPnP, I suggest checking the actual network traffic with wireshark or similar. Make sure the M-SEARCH message is correct on the wire. – Jussi Kukkonen Aug 17 '16 at 12:46
  • Lots is a definition,, I have like 15 units who answers on a general call,, 2 of them also answers on a specific call. – lg.lindstrom Aug 22 '16 at 06:35

2 Answers2

0

Added a filter of my own, to let only valid services pass to the registry.

lg.lindstrom
  • 776
  • 1
  • 13
  • 31
0

A "restricted" search means you would like matching devices to answer. But any device is free to answer or in fact "be discovered" at any time, this is just how UPnP works. Searching with a restriction is supposed to speed up discovery, ideally (in practice no device manufacturer cares). If you only want to work with a particular service, filter in the deviceDiscovered etc. callback methods in RegistryListener.