NSConf: Game Kit and Online Play
by john on Feb.21, 2010, under Uncategorized
Jeff LaMarche
GameKit is a provided framework that only works over bluetooth. Some hardware doesn’t have support for this functionality.
Handles peer discovery and connection.
Three modes: Server, Client, and Peer. Peer is the friendliest to use.
Important to set delegates to nil prior to releasing the associated object.
Very easy to send data to all peers. You can send to specific peers as well.
Data always arrives intact so one send results in one receive.
Bluetooth is a very easy way to have multiplayer.
Online play is more difficult.
Apple doesn’t want you to use threads for networking. Use the UIApplication event loop instead.
NSStream doesn’t have a concept of discrete data. So sends don’t equal receives.
Use Bonjour to be able to find peers.
http://iphonedevbook.com/ has code for this networking stuff.