Behind NAT to behind NAT connection

前端 未结 2 1135
离开以前
离开以前 2020-12-10 04:35

I\'ve come across an interesting problem. Basically I have 2 mobile phones that are both behind NATs. I want to communicate directly between the 2 devices using UDP.

相关标签:
2条回答
  • 2020-12-10 05:09

    You need a mediator server, so the clients can tell where they are. Then one opens a server by uPNP, and the other connects to it.

    0 讨论(0)
  • 2020-12-10 05:10

    What you're looking for is UDP hole punching, see e.g. http://en.wikipedia.org/wiki/UDP_hole_punching

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

    0 讨论(0)
提交回复
热议问题