简体   繁体   中英

Search only for my Services

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

添加了我自己的过滤器,以仅将有效服务传递给注册表。

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM