This chapter explained how to publish a service on the network using the NSNetService class and how to discover services on the local network using the NSNetServiceBrowser class. Once peers are discovered on the network, you can connect to them and initiate peer-to-peer communication. A chat application is a good example of a Bonjour application.
EXERCISES
Answers to the exercises can be found in Appendix D.
WHAT YOU LEARNED IN THIS CHAPTER
TOPIC | KEY CONCEPTS |
Publishing a service | Use the NSNetService class. |
Discovering services | Use the NSNetServiceBrowser class. |
Resolving the IP address of a service | Use the resolveWithTimeout: method of an NSNetService object. |
Getting the IP addresses of a service | Use the addresses method of an NSNetService object. |
Method that is called when a service is discovered | netServiceBrowser:didFindService:moreComing: |
Method that is called when a service is removed | netServiceBrowser:didRemoveService:moreComing: |
3.21.114.230