Multiple peers connected - iphone

I'm developing a game that requires up to four iPhones or iPod Touch to connect each other to play in turns.
My question is, how can I accomplish this via GameKit. I've read that using client/server sessions is the way of doing it. But I can't find any examples that would illustrate this.
Is it really possible to do it, or there can only be two devices connected at a time.
I'd really appreciate if you all could help me with a code sample.
Thanks.

What you are trying to do is possible with the Gamekit framework. Easiest method is to use bluetooth, which means short range (as in the same room). I'm working on a similar application with the Gamekit framework. Look at the sample code on developer.apple.com for GKTank and GKRocket. These game demos are for two devices, but the framework will support what you need. In a bluetooth piconet you can have eight devices connected. Hope this helps you get started.

Related

Direct VoIP call from one iOS device to another

I'am going to develop peer-to-peer VoIP iOS application. And want do it without any SIP proxy, SIP providers and other servers. Just VoIP calls frpm iOSdevice-to-iOSdevice. Both iOS device could be somewhere in Internet. Is it real in VoIP (with PJSIP for example and general with SIP)?
Could you please point me to main keys that I need for development.
I have already read these topics. Is it real solve problems with addressing in my configuration. PJSIP could help with correcting addressing?
Look at Apples Multipeer Connectivity framework. I have built an app that does exactly what you want. If you look to my profile and the questions I have asked you will get some good guidance. Though I recommend you do it with a backend since MultiPeer wasn't the best solution, atleast when it comes to supporting multiple peers and to be able to call another device that has the app in the background.
See Frank Shearar's Answer Here
In short, it looks like this would be a very difficult task.
Another option would be to use the Twilio SDK for iPhone (Obj-C). This would work well for what you're trying to do and would be a whole lot easier. Link

Communication between two iOS devices

I am looking for a way to have one iPhone app send a message to another app on a different phone (sort of like a Sender-Receiver set up). I am looking for the best possible way to do this. Does anyone have any ideas and/or tutorials?
Thanks for the help.
You should use GameKit. It is super easy to send messages between two iOS devices using it. Here's a great tutorial: Game Kit. You can also get more information about it here from the docs: About Game Kit.
You communicate by creating an ad-hoc bluetooth or local wireless network.
lmirak provided insightful info about device communication(especially about GameKit). I would like to add one more solution. You can use WiFi network to do your device communication.
See the link or download the sample application from developer.apple
The sample application named as WiTap. It demonstrates how to achieve network communication between applications. Using Bonjour, the application both advertises itself on the local network and displays a list of other instances of this application on the network.
If your app is only going to run on iOS, then you should use the fantastic MultipeerConnectivity library. https://developer.apple.com/documentation/multipeerconnectivity
If you need a solution that will work cross-platform, then one way to accomplish this is using sockets and connecting over a local network. On iOS you can use CocoaAsyncPods for sockets and NetService for discovery.
Here is a basic example app that does this: https://github.com/brendaninnis/LocalNetworkingApp
, which I explain in great detail here: http://brendaninnis.ca/connect-nearby-devices-part-1.html

Example of Bluetooth/Bonjour communication on iOS5

Up until iOS5 CFNetwork was all you had to use to be able to find and connect to devices using both WiFi and Bluetooth, but as of iOS5 Apple decided to restrict CFNetowrk to only find and comunicate with services over WiFi (Technical Q&A QA1753) So I was left with a huge amount of code that I cant use no more and must now focus on C based implementation using C based API to rewrite bluetooth communication over bonjour.
Since this is the low level type of code, and I am not a deep C diver, I would like to know if there are examples or even better sample code of such communication, where you have a Server class and Browser class. It will take me ages to write it my self, so if you know any of those samples I would greatly appreciate it.
You should check out to see if Apple GameKit would fit your needs.
GameKit handles pairing Bluetooth devices. You implement you own pairing of WiFi connected devices. GameKit handles the rest of the communication.
I was facing similar problems wanting to use both WiFi and Bluetooth. GameKit worked very well for me. Reduced my networking code by more than half.
Apple has good sample code on their developer site.

iPhone to iPhone networking

I am interested in developing an iPhone application that creates ad-hoc networks between iPhones.
Is such an application feasible?
I am a novice with iPhone development, so I apologise in advance for my naiivety.
Thanks
In iPhone OS 3.0, Bluetooth is used to create an ad-hoc network and has been developed for this purpose.
Here is some documentation.
http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/GameKit_Guide/GameKitConcepts/GameKitConcepts.html
On a side note, there are some games that use the current access point and scan the subnet that they are on and find other listening clients. Then they create a game that way.
I know this is an old question, but since I just researched a similar topic, I wanted to share the results in case it's helpful to someone who searches for this in the future.
Newer iOS versions include Game Kit, a set of APIs allowing developers to create peer-to-peer networking systems over WiFi or Bluetooth. This appears to be exactly what the poster is requesting.

iphone and bluetooth device

could i connect my nokia phone to iphone using the following Object..?
1)GKPeerPickerController
2)GKSession
i mean (GameKit)
note that here not two iPhone but it is one iPhone other one is only one Bluetooth device..
thanks and regards
jalju
Could you be a little bit more specific about what your purpose is?
Are you trying to create a cross-platform game or simply transferring data between the devices?
Though the documentation clearly states that:
The GKPeerPickerController class
provides a standard user interface to
allow an iPhone to discover and
connect to another iPhone.
So I don't think this is the right way to go.