0

Can I implement two GKSession, one as a client and the other as a server at the same time? Is there a problem or any limitation to implement this connection with WiFi and Bluetooth? Thanks!

shiami
  • 7,174
  • 16
  • 53
  • 68
  • I finally created two different sessions for both GKSessionModeServer and GKSessionModeClient. – shiami Mar 14 '12 at 03:07

2 Answers2

1

You can do this using GKSessionModePeer:

    gkSession = [[GKSession alloc] initWithSessionID:nil displayName:nil sessionMode:GKSessionModePeer];

In peer mode, you act both as a client and as a server for other devices.

killdash10
  • 706
  • 5
  • 12
  • Is it able to connect to several peers at the same time? – shiami Mar 14 '12 at 03:06
  • Yes. "Note: The maximum size of a client-server game is 16 players." Source: http://developer.apple.com/library/ios/#DOCUMENTATION/NetworkingInternet/Conceptual/GameKit_Guide/GameKitConcepts/GameKitConcepts.html#//apple_ref/doc/uid/TP40008304-CH100-SW1 – didito Jun 07 '12 at 15:53
  • Gets very unreliable if more than two are connected with eachother. – openfrog Nov 20 '12 at 21:39
0

GKSessionModePeer seems only can connect to another peer. But I need to build up more complex network structure. So I finally created two different sessions for both GKSessionModeServer and GKSessionModeClient. And it can exist at the same time.

shiami
  • 7,174
  • 16
  • 53
  • 68