Per NAT to connect NAT

I ran into an interesting problem. Basically, I have 2 mobile phones that are behind NAT. I want to communicate directly between two devices using UDP.

I know that if I initiate a connection with phones on the server, then I can send data back to this connection with the phone (i.e. send it back from the same port that received the message, to the same ip and port that it was received from). Therefore, I can easily establish a connection between the two devices by connecting both phones to the server. Then send the data to the server and redirect it to the phones. This circumvents any NAT traversal issues that I may encounter.

However, I would rather just use the server to point 2 devices at each other and then let them communicate directly. How can I do it? Is it possible to use something like uPnP?

Any help would be very helpful!

Edit : I found this document http://www.brynosaurus.com/pub/net/p2pnat/ It seems that the translation of the studs is what I need, but it does not look widely supported. I wonder how good the support of the mobile Internet provider for UPnP is.

+8
mobile udp p2p nat nat-traversal
source share
2 answers

What you are looking for is punching UDP holes, see for example http://en.wikipedia.org/wiki/UDP_hole_punching

The basic idea is simple: you tell each endpoint to use ports, and they start sending udp packets. NAT'ing devices will set the crawl rule when they see the first outgoing packet, and then the next attempt from the other end will match this crawl rule.

+4
source share

You need a reseller server, so clients can determine where they are. Then the uPNP server opens, and the other connects to it.

+4
source share

All Articles