2

Some people pointed out that Bonjour is more reliable. Bonjour only is WiFi and does not support Bluetooth, no?

There must be an alternative to GKSession which just combines all the good things of Bonjour and Bluetooth in one simple to use API but I can't find it.

I need to automatically connect up to 8 devices for a game where players can join anytime, and GKSession seems to have a total limit of 3 for PeerToPeer.

Marco
  • 6,692
  • 2
  • 27
  • 38
openfrog
  • 40,201
  • 65
  • 225
  • 373

2 Answers2

1

GKSession will allow for up to 16 devices as of iOS 6, I believe. It should certainly work with at least 8, being that Bluetooth supports 8 devices.

I have successfully connected 6 devices without issue.

Mark Pauley
  • 1,445
  • 12
  • 11
  • Well, I shouldn't say no issue... The bandwidth and latency go nuts after 3 or so devices. – Mark Pauley Feb 04 '13 at 22:56
  • So: Anki Drive is doing this currently with Bluetooth Low Energy via CoreBluetooth. Checkout my example code at https://github.com/pauley-unsaturated/Bleatr – Mark Pauley Feb 16 '14 at 05:08
1

Updating for iOS 7, since GKSession is now deprecated.

The Multipeer Connectivity framework's MCSession class can connect up to 8 peers (current value of kMCSessionMaximumNumberOfPeers).

For anyone interested, I created MCSessionP2P, a demo app that illustrates the ad-hoc networking features of MCSession. The app advertises itself via Wi-Fi or Bluetooth and programmatically connects to available peers, establishing a peer-to-peer network.

Marco
  • 6,692
  • 2
  • 27
  • 38
  • Hi Marco. I got a question. The MCSessionP2P keeps disconnecting the session in background. Is there a fix for this? – Legolas Jul 14 '14 at 22:26
  • @Legolas check out http://stackoverflow.com/questions/22138622/can-i-have-a-multipeer-connectivity-session-run-in-the-background – Marco Jul 15 '14 at 22:36
  • It will stop advertising/browsing in background but It is possible to hold the session in background. It should still be connected. – Legolas Jul 15 '14 at 22:42