In this article, we zoom in on establishing a connection between two devices running an instance of the game we are about to create. Even though this may sound trivial, there are quite a few components involved to make this work. Before we get our hands dirty, let me walk you through the process step by step. In the previous article, I wrote about the client-server model. Before we create the game itself, we need to implement the client-server model in the application. Two devices each running a different instance of the game won't magically find each other on the network and start a game. One instance needs to act as the server and make it known to other instances on the network that they can join. A common approach to solve this problem is by allowing players to host or join a game. The device of a player hosting a game acts as a server, while the device of a player joining a game acts as a client connecting to a server. The server provides a service and it can announce this on the network using Bonjour. The device of the player looking for a session to join searches the network for services also using Bonjour. When a player joins a game, the service is resolved and the client device attempts to establish a connection between the two devices so that the game can start. If you are confused by the client-server model, then I recommend revisiting the first part of this series in which the client-server model is described in more detail.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

</ span>iPad,iPhone,iPhone Resources,iPhone Articles,iPhone Development,iPhone Turorial,Mobile Development Tutorials,Mobile Developments,Objective C,Game with Bonjour,Bonjour