Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 9. Using the CFNetwork and Cocoa APIs

Chapter 9. Using the CFNetwork and Cocoa APIs

In the previous three chapters, you have learned about techniques and APIs that work on multiple platforms. In Chapter 6, we covered the general concepts and the dns-sd command-line tool, which apply to all the supported platforms. In Chapter 7 we covered the DNSServiceDiscovery C API, which is available on all the supported platforms. In Chapter 8, you saw the Java API, which lets you write a Java program that will run on any supported platform with Java installed.

If you’re writing a program in C that’s built around a Core Foundation CFRunLoop as its central event-handling mechanism, or a program in Objective-C that’s built around a Cocoa RunLoop as its central event-handling mechanism, you have two options. The first option is that you can use the standard C DNSServiceDiscovery API and add those active operations as event sources to your RunLoop, as shown in the Core Foundation and Cocoa examples toward the end of Chapter 7. If you’re comfortable mixing standard C in with your Core Foundation-style or Cocoa-style programming, this is fine. However, if you prefer to stick to a single programming style, then you have a second option: Apple has provided additional wrapper APIs that follow the Core Foundation and Cocoa idioms.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial