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

Publishing a Bonjour service

Bonjour allows for the discovery of network devices and services on an IP network without a centralized server. In this recipe, we will create a class called BonjourPublishServices that will contain the code needed to publish a service with NSNetService.

The NSNetService class is normally used to publish information about a socket server. While it is also typical for NSNetService and the socket server to be running within the same application, it is not a requirement since NSNetService does not use, nor is it dependent on the socket server in any way.

As the publication of the service may not happen instantaneously, NSNetService should publish the request asynchronously. NSNetService uses delegate methods to handle the ...

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