[OT] Handling multiple UDP clients through NAT

Levi Pearson levi at cold.org
Sun Feb 4 15:36:09 MST 2007


Steve <smorrey at gmail.com> writes:

> Hello again everyone,
> While designing my new MUD server I ran into a design problem that I'm
> hoping someone here has had experience with.
>
> Specifically, I currently keep track of clients in a hashmap, with the
> hash being comprised of their IP address and port.
>
> This works very well until multiple clients who are NAT'd try to connect.
>

Solution: Use TCP.  Keeping track of connections is what it was
designed for, and fortunately pretty much all network hardware is
designed to work with TCP connections, so you don't have to hack your
way around them.

Why did you choose to use UDP in the first place?  If you must use
UDP, just arrange for a unique key for each client to be created when
they authenticate with the server, and tag all subsequent packets with
that id.  Untagged packets that are not attempts to log in can be
dropped, and tagged packets can be properly routed to wherever they
need to go.

But I strongly suggest you just use TCP.

                --Levi



More information about the PLUG mailing list