1

I intend to create an application that can send file from one phone to another phone (with API level 10) that are on separate networks without a server.

I found some socket-based file sending solution and they worked in a LAN: I could send files from a phone to another one.

However, when I was on a separate network, the server address 192.168.0.102 (obviously) became invalid because it is a local address.

How can I access the other phone over 3G or if it is in a separate network?

Nestor
  • 8,194
  • 7
  • 77
  • 156
  • I think, you can't do this without server. Your phones don't have public IP address. They have only local addresses, and you can't access by it. I think a lot of providers use NAT and don't provide "real" ip address to devices. – Alexander Mikhaylov Jun 06 '14 at 14:16
  • Sockets are not interested in being on LAN, WAN or 3G. They always work. You have a server app and a client app. If they are on separate networks but have both internet connection you should find out the external/internet ip of the router where your device (server) is connected to. Browse on that device to http://whatismyip.com and you know. On the router forward the used port to the local ip of the device. On the client device use the servers external ip. If on 3G there is no router so you can connect directly. But be aware that many providers don't accept servers on devices. – greenapps Jun 06 '14 at 17:44
  • Please, verify my assumption: **if it is on a 3G network, there is no way to connect with sockets**. So this is why I can't find any phone-2-phone solution... – Nestor Jun 06 '14 at 18:18

1 Answers1

0

You can't do that without a mediator server.

The solution is here.

Community
  • 1
  • 1
Nestor
  • 8,194
  • 7
  • 77
  • 156