0

I have requirement like, One iPhone Device acts as a server and several iPhone devices acts as a clients.I have to communicate the client devices to the Server Device over Wifi. How Can I achieve this. It would be appreciated if Could you provide any tutorial. Thanks in Advance..

krishna
  • 97
  • 1
  • 7

4 Answers4

0

!!! NOTE:
Below answer suggests an API that has been deprecated since iOS 7.


you are looking at GKSession.. and this is an excellent and comprehensive tutorial for what you're looking for. IF you wanna dive a little deeper take a look at this project I made.

the link in the comment above uses bonjour, which is a layer below GKSession (ie GKSession is a wrapper for bonjour).. so depending on how many devices you want to connect at a time (GKSession starts choking around 3-4) and how extensive your throughput/ping requirements are, you'd chose one or the other.

Nikolay Suvandzhiev
  • 8,465
  • 6
  • 41
  • 47
abbood
  • 23,101
  • 16
  • 132
  • 246
0

Please look at following links these may be useful to you

Cocoa Http server.

how-to-make-ios-application-act-as-web-server

communicate-between-iphone-devices-over-the-3g-networ

Community
  • 1
  • 1
Avtar Guleria
  • 2,126
  • 3
  • 21
  • 33
0

Take a look at the Game Kit class. Game Kit provides classes that implement the low-level networking infrastructure to allow the devices to exchange data in real time.

https://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/Introduction/Introduction.html

sangony
  • 11,636
  • 4
  • 39
  • 55
0

If anyone is reading this in/after 2018, the current approach is:

MultipeerConnectivity


Docs:

MultipeerConnectivity
https://developer.apple.com/documentation/multipeerconnectivity

Cross Platform Nearby Networking
https://developer.apple.com/videos/play/wwdc2014/709/

(GKSession has been deprecated since iOS 7)

Nikolay Suvandzhiev
  • 8,465
  • 6
  • 41
  • 47