Chapter 7. Using the C APIs
In Chapter 6, you experimented with advertising, browsing for, and looking up Zeroconf services from the command line. In this chapter, you will learn how to perform those same operations programmatically, using the C APIs. The remaining chapters in the book address other APIs and languages. In each of the APIs, the general concepts are the same—you perform one of the basic DNS-SD operations and then receive results asynchronously. In C, this means you initiate a DNS-SD action such as browsing and provide the address of a callback function. When there is a response, the callback function is called and the appropriate information is passed to it. By the end of this chapter, you could write your own version of the dns-sd command-line tool.
If you skipped the preceding chapter, you may want to go back and read it, since the dns-sd command-line tool is a good learning tool for exploring the concepts, and it’s a good debugging aid if your code is not working as expected. If you are creating a program that registers a service, then you can browse with the command-line tool to verify that the service is being advertised. As you run and quit your growing application during development, you can leave the command-line browser running in a terminal window to confirm when you have successfully registered your service. Similarly, if you are building an application that needs to browse for services of a particular type, and you don’t have any real instances of that ...
Get Zero Configuration Networking: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.