Advertisement

Dynamic Routing Of Ports

Started by October 13, 2006 05:03 PM
4 comments, last by hplus0603 18 years, 4 months ago
Can dynamic routing change the port number during program execution? For example (all using 1 UDP per program): Say we have 3 players, A B C. A connects to B (x.x.x.x:xxxxx connects to y.y.y.y:yyyyy). Then B connects to C (y.y.y.y:yyyyy connects to z.z.z.z:zzzzz). Lets assume those 2 connections work fine. Then, without closing the UDP ports, A tries to connect to C. To avoid firewalls, A sends to z.z.z.z:zzzzz while C sends to x.x.x.x:xxxxx. Is that guaranteed to connect? Or is it possible A's port is xxxxx for his connection with B and xxxxx2 for his connection with C? Thanks for any help
-------Harmotion - Free 1v1 top-down shooter!Double Jump StudiosBlog
That's known as NAT punch-through; there are links in the Forum FAQ to more complete references.

In the case that it works (A and C can talk) then A and C use "cone NAT" which is the most compatible form of NAT (and the most common, these days).

In the case that it doesn't work (A or C get a new external port) then A or C use a "symmetric NAT" which is less compatible, but does still exist, especially in corporate firewalls.
enum Bool { True, False, FileNotFound };
Advertisement
Interesting stuff. That appears to eliminate any possibilities of p2p communication. Is that true? Is my matchmaking server useless unless it wants to route packets?
-------Harmotion - Free 1v1 top-down shooter!Double Jump StudiosBlog
That's not what it says. It says that p2p punch-through works for clients that have cone NAT, only symmetric NAT poops the party.
enum Bool { True, False, FileNotFound };
Right. So there is no way to have p2p communications with either person behind a symmetric NAT?
-------Harmotion - Free 1v1 top-down shooter!Double Jump StudiosBlog
To get through symmetric NAT, you would have to guess at the port that would be allocated for the next connection. That sometimes works, but often doesn't. So, no, not in general.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement