SUMMARY

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

  1. What class can you use to publish a service on the network?
  2. What class can you use to discover services on the network?
  3. Name the method that is called when a service is discovered.
  4. Name the method that is called when a service is removed.

    Answers to the exercises can be found in Appendix D.

image 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:
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.114.230