In the company I’m working we have our own iOS\Android\WP apps which allow our employees to share a certain type of files to each other. This app works through our server but recently we encountered a situation when some of our employees need to reach to each other, they’re even in the same building, but can’t due to a restricted connection to the internet outside of the country. Installing a server in this country is out of the question so now we’re looking for an alternative solution.

Is there any way to make two mobile devices with the app to connect directly to each other in order to exchange information? Using e-mail or any other common communication is out of the question since files sent from one app to another had to be processed and displayed in a very specific way (it’s complex technical specifications) plus policy of our company strictly prohibits usage of a 3rd party servers to exchange information.

The problem we’re facing is that since both devices are simply using a local mobile ISP it’s impossible to establish a direct TCP connection because both devices don’t have an external IP address which could be used to reach this device. So as far as we can tell trying to connect 2 devices directly over the internet is a lost cause. Are we correct in this assumption? Maybe we’re overlooking some possibility to achieve our goal?

I will appreciate any ideas.

  • Have a look at bluetooth. It will require the guys to be close to each other. But with an appropriate bluetooth LAN connection your two devices will be able to talk to each other using TCP and UDP packets Apr 16, 2015 at 12:08
  • @Ptolemy that's what we're using right now but disadvantage of having a need for both to be close to each other is making it a very poor solution since the app was designed in order to give people sitting in a different conference rooms a way to exchange a certain corporate information while talks are going on. Apr 16, 2015 at 12:14
  • If you wanted a sledgehammer solution you could use Tor to get around any ISP or country imposed network restrictions. You could configure it to only use exit nodes in your country where you know you'll have unhindered access to your corporate server.
    – MetaFight
    Apr 16, 2015 at 12:20
  • Can you VPN to a central server from those locations? Apr 16, 2015 at 16:28

4 Answers 4


Can you connect both the mobile devices to the same WiFi network?

Mobile apps can open ports and make network connections, and you can use this functionality to have apps talk directly to each other.

There are a number of practical difficulties, including how to find the IP address of the other device, and how to authenticate connections. I expect your app will require significant changes; if it's designed to work client/server, moving to peer-to-peer can be a major change.

Do you have to use mobile apps? If this was a Windows app that just opened a file, it would be easy to transfer such a file using a USB stick, direct copy, etc.


Perhaps you might want to take a look at DHT:


It's what peer-to-peer software like BitTorrent, Freenet, RetroShare, or Tox build upon.


I'm not sure this is a realistic answer because it's a bit heavyweight.

If you can't trust the networks your users are connected to, you could always have them fallback to a network you can rely on.

So, for example, if your users are in a country that restricts access to your corporate server, have your mobile client fallback to using Tor.

You can configure Tor to use only exit nodes in your corporate server's country, ensuring unhindered access to it.

  • Interesting suggestion. We haven't thought about Tor really. Will definitely explore this option. One of my concern is that there might potentially be some restrictions on using Tor within iOS or WP. Apr 16, 2015 at 13:08

Similar to paj28's answer, but if both mobile devices can use WiFi, then there's an easy solution.

  1. Have both devices connect to your server over WiFi(they seem to be capable of doing this anyways, so I'm assuming this won't be a problem)

  2. Have the server record their connection information(Name, IP address)

  3. Pass all connection information to all connected clients

  4. Connected clients now have enough information to directly connect to each other without the server mediating the connection, and it stays within the LAN of your building.

In this situation you enable peer-to-peer connections but avoid the nasty business of finding peers. The server records the information necessary for peers to connect to each other, and you can either push that information out periodically or have the clients poll that information from the server so it only goes out on an on-demand basis.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.