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

Creating an echo client that uses Bonjour to discover the service

In the previous recipe, we used the CFSocketServer and BonjourPublishServices classes to create an echo server and to publish it. In this recipe, we will be using CFSocketClient, BonjourBrowserService, and BonjourResolverService to find the echo server and to connect to it.

The downloadable code for this chapter contains a BonjourEchoClient project that will search for servers published by the BonjourEchoServer project, which was covered in the Creating an echo server that uses Bonjour to advertise the service recipe, and then we will send a text string to the server. The server should respond back with the same string that we sent.

If the client is unable to find any published echo ...

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