O'Reilly logo

iOS and OS X Network Programming Cookbook by Jon Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Discovering a Bonjour service

In this recipe, we will use the NSNetServiceBrowser class to look for our published service.

The NSNetServiceBrowser class is used to find the services that are published by NSNetService. Once we initialize the NSNetServiceBrowser object, we need to assign a delegate, and then we can begin browsing for services. Taking into account the possibility of delays in receiving responses from the services and also because services can come online or go offline at any time, the NSNetServiceBrowser object performs the service discovery asynchronously. The NSNetServiceBrowser class relies on the delegate methods to handle the notifications of the services coming online or going offline.

Getting ready

This recipe is compatible ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required