Question

I'm mostly interested in a general answer for mobile, but something android specific would be acceptable.

Given 2 mobile devices, how can I get a connection between them. I'm new to mobile development, and I'm not sure what kind of NAT mobile devices are behind. Is it possible to do some sort of "hole punching"(using an outside server to aid in getting a connection) to connect them together?

I've looked at this question, but it didn't help me too much, I still don't know how to get an IP and/or traverse a NAT. Android - communicating between two devices

Était-ce utile?

La solution

If you want to use general wireless module, like GSM, UMTS, LTE you need to provide standalone hardware with implementation of desired protocols. For GSM you could look into OpenBTS http://openbts.org/ which is free software.

As other communication possibilities, you can use Wi-Fi Peer-to-Peer http://developer.android.com/guide/topics/connectivity/wifip2p.html for establishing wifi connectivity.

Communication abilities are based on a chip's specifications, not all wi-fi support this kind of connection. On the other hand you can also establish Bluetooth connectivity.

Autres conseils

http://developer.android.com/training/connect-devices-wirelessly/index.html refer this one..

also You can communicate two devices in application using Bluetooth API or using Socket Programming.

I would have both of them connect to a server on the Internet - maybe a web server - maybe you start off with an Amazon EC2 instance. Phone sends messages to server using a HTTP request and server sends messages to other phone using HTTP Push of some description. Skype and it's ilk used a technique called UDP hole punching to communicate peer-to-peer (although mediated through a central server) although I believe they had to stop due to lawful interception (cough NSA) requirements.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top