I've read about the Quake 3 networking code that they had to deal with a situation where some older NATs would randomly switch client ports.

How common is this issue these days? Is it worth handling when implementing a game network protocol?

In other words, would a UDP network protocol implementing virtual connection need to handle the case where the NAT suddenly changes the client's port?


You should not rely on source ports being stable between connections from the same host, and if you are using UDP (generally recommended for gaming applications as maintaining low latency trumps needing reliable delivery) which is connectionless you should not expect them to be stable between individual packets.

NAT by its nature usually needs to play with source port information so this compounds the situation, and while single-level NAT can be relatively clever and try to keep source ports for packets from a given host to another stable as soon as you have more than one layer (not uncommon in mobile networks and some free wireless access points) that goes out of the window.


No, it's not worth handling. Proper networks don't use older NAT, they use the correct tool for the job.

  • how likely is one to encounter this in the wild? – Nuoji Jul 30 '13 at 16:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.