Peer-peer connection having different IP Adress

263 views Asked by At

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 ?

1

There are 1 answers

2
James Donald On

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