How to get the list of all announced bonjour services on all available domains?

人盡茶涼 提交于 2019-12-20 10:39:24

问题


It's not the problem to look in all domains, but I can't find the right way to look for any service on the network.


回答1:


Old thread but there is a way to find the local services Discovering all advertised Bonjour service types. You will need to do some manipulation of the results to get the types in the correct format. This works on Mac & iPhone although no services are discovered if I haven't got a Wifi connection on iPhone.

    NSNetServiceBrowser* domainBrowser = [[NSNetServiceBrowser alloc] init];
    domainBrowser.delegate = self;
    [domainBrowser searchForServicesOfType:@"_services._dns-sd._udp."
                              inDomain:@"local."];



回答2:


To my knowledge, there's not a function that will search for all available services. The reason is probably because an application publishing a service can define its own service type.

If you are only looking for services of common types (HTTP, printer, etc) you can easily create a loop to call -[instanceOfNSNetServiceBrowser searchForServicesOfType:inDomain:] with all the types you want, in all the domains you previously discovered.

The developer docs guide section on setting up a NSNetService can also be of aid.



来源:https://stackoverflow.com/questions/1587264/how-to-get-the-list-of-all-announced-bonjour-services-on-all-available-domains

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!