2

I am trying to implement a sort of chat between multiple IPhones, where one IPhone serves as a server and the rest connect to it. I have a main server which the rest of the phones get data on the connection, but I am not sure what data to send.

I know the IP of cellphones is highly dynamic, and I am not sure how to track the change of the IP and how to connect to it, and keep the connection while the IP changes.

I have read a bit about GCDAsyncSockets and know ho to listen to connections, but it still requires a static IP. Is it even possible? I mean I read around and it sounds like it is possible, but I really have no Idea how.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
gilmishal
  • 1,884
  • 1
  • 22
  • 37
  • just to make myself clear, I want most of the data between IPhones to be sent directly between the IPhones, and minimize the use of a main server. – gilmishal Jul 12 '14 at 13:20
  • Are you using Wi-Fi to create sockets over a LAN? Or are you establishing sockets over the internet? If the latter, then I think you are stuck having to use a central server with a fixed IP, or manually establishing a connection when a socket gets broken due to a changed IP. – user2338215 Jul 12 '14 at 16:21
  • You can use bonjour to locate services dynamically (this is how an iPhone can find an Airplay device without know IP addresses for example) or you can use the multipeer framework. – Paulw11 Jul 12 '14 at 21:21
  • The thing is I need it over the Internet... manually establishing a connection might work, but do I have to implement it myself, or is there a third party that does it for me, and how bad does it effect the IPhone resources? – gilmishal Jul 12 '14 at 22:32
  • I don't think that iOS device resource usage (processor cycles or memory) would be significantly higher for an Internet-capable solution. The device would need to establish a connection with the remote server, then re-establish the connection whenever the socket gets broken (e.g., due to new IP address assignment). There might be such a service available, but I'm not aware of one, so you might have to do both the server and client sides work yourself. – user2338215 Jul 13 '14 at 22:00

0 Answers0