Chapter 7. Networking Concepts

WHAT'S IN THIS CHAPTER?

  • Publishing network services

  • Browsing available network services

  • Sending data objects between peer devices

  • Sending voice between peer devices

This chapter explains how to register and discover network services, and describes the communication process between devices using the OS's built in connection software, Bonjour. Two foundation classes are defined for managing Bonjour network services:

  • NSNetService — An actual network service

  • NSNetServiceBrowser — A browser for the related network service

The process used by these two foundation classes are defined by three basic operations:

  • Registration (server side) — NSNetService

  • Browsing (client-side discovery of domains and services) — NSNetServiceBrowser

  • Resolution (client side) — NSNetService

The first example application in this chapter demonstrates publishing by the server, and browsing by the client to discover domains and services. The results of the process will be listed in a Table view on the device, and the server application is a desktop-based application.

When there is a requirement for devices to communicate with each other, iOS 4 has a framework, GameKit, that insulates the details in two classes:

  • GKSession — For networking handling

  • GKPeerPickerController — Provides a UI for connecting

The process used by these two foundation classes are defined by three basic operations:

  • Initialization of the GKSession

  • Connection between the users

  • Data exchange between the peers

The UI for connecting between ...

Get Professional iPhone® and iPad™ Application Development 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.