0

I want to connect devices having different IP Address.

For Example:

Device A is using Mobile networking and Device B is also using a mobile network .then Is it possible to connect them ?If Yes How ,If no why ?

Jayaprada
  • 944
  • 8
  • 11
  • 1
    Can you clarify your question? You're working on iOS app? Where is your code? – Raptor Jun 06 '14 at 08:11
  • Yes @Raptor its an iOS app .I want to connect devices .I have already implemented using GKSession (Game kit).But now I want to connet that using internet – Jayaprada Jun 06 '14 at 09:38

1 Answers1

1

The devices will have different IP address by definition, otherwise there is a problem in the setup of your network and will result in packet collisions and dropped connections. Perhaps what you mean is, how do you connect devices that are on different networks, i.e., one is connected via a cellular network, and the other is connected via your WiFi?

If the devices are not in close proximity, you need to identify their corresponding IP addresses and then establish a typical connection, for instance via NSURLConnection. Before you can do that, you will need to configure your WiFi's router to bridge your device's IP with the router's IP, allocated by the WAN side of the network. You device will then become accessible at the router's WAN address.

If the devices are within proximity, you can use the Multipeer Connectivity Framework, available in iOS 7. Since they are on separate networks, a bluetooth connection will be required. The framework can handle for you automatically the discovery and negotiation phase of the connection, so you only need to worry about pushing your content. You can read the guide here:

https://developer.apple.com/library/ios/documentation/MultipeerConnectivity/Reference/MultipeerConnectivityFramework/Introduction/Introduction.html

  • Thanks for your answer.TWo devices may be using two different mobile network.Then only also their IP Address will be different.My question is is it possible that if two devices both have different IP Addresses and I want to connect that.I already implemented that using MPC Framework . – Jayaprada Jun 06 '14 at 09:29
  • @Jayaprada If I understand correctly what you are asking, the answer above should address your problem. If you think it will not, please try to better explain why, so we can have a better chance to figure out what your exact situation is. – James Donald Jun 06 '14 at 18:12