0

I want to build an (Android) application that works over p2p like so

Server (list of peers (usernames & ip's))

&

Phones (fetch list of peers from server and create a socket chat between them(phone to phone), no server involved)

So far I've set up the server and a phone client that sends a message and is received by another server (which eventually will be in the other clients phone). BUT, I ran into the problem that phones are assigned ip's via NAT and I need to do NAT Traversal.

I was wondering, is there any simpler options to go about the NAT Traversal? Perhaps use an XMPP port with libjingle in it? (A la ASmack). or should I just use JSTUN or some other framework for android? What do you guys recommend?

Thanks

user824015
  • 89
  • 3
  • 12
  • is this a dup of http://stackoverflow.com/questions/10014515/android-p2p-direct-connection-over-the-internet-behind-nat ? – J-16 SDiZ Oct 31 '12 at 06:09
  • J-16 SDiZ, but that uses the server in the middle for communication correct? All I want my server to do is store a list of IP's and usernames. – user824015 Oct 31 '12 at 06:16

1 Answers1

0

Check out: Kryonet.

You can discover the server in a LAN connection with just one line of code through Kryonet, and then retrieve all the clients' address and try connecting with them based on your application design.

It even has a Chat Application as an example and Kryonet runs on Desktops and Android devices.

If you have a static global IP, then you can write server code using Kryonet very easily which holds a map of online users and their IP, and which can then do a hole punching to establish a P2P connection if they are not in the same LAN.

Aman Agnihotri
  • 2,973
  • 1
  • 18
  • 22