OK, so TCP works very nicely with NAT. You simply forward the ports on the server, and your clients can all establish outgoing connections fine.
With my game, I have both TCP and two-way UDP communication.
My idea is to connect with TCP, then open a UDP port on each end, exchanging the port’s via TCP. Then each computer would try to send UDP datagrams to the other.
This works great in a LAN.
But, I am having problems when trying to comminicate from one NAT’d LAN to another NAT’d LAN (over the internet). I had hoped that the NAT router would see the outgoing UDP packet and allow incoming connections on the same port. But this doesn’t seem to hold up.
How then can things like DNS queries work? I send a request from inside a LAN behind a NAT firewall to a DNS server on port 53. Presumably, it replies with a datagram to the port I used, and the NAT router knows where to send the packet.
I am dearly hoping not to have to tell my users to start forwarding ports
Does anyone have experiance dealing with this? I would love to know how you did it.
Thanks,
Will.