[OT] Handling multiple UDP clients through NAT
Bryan Sant
bryan.sant at gmail.com
Tue Feb 6 14:03:42 MST 2007
On 2/4/07, Levi Pearson <levi at cold.org> wrote:
> 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.
What Steve wants to do can be done with UDP. It's the layer 3 part of
the TCP/IP stack that handles source/destination address:port
information. UDP is built on IP (and TCP is built on UDP), so Steve
can keep a unique list of users based on a source ip:port hash. So it
is possible.
However, I completely agree with Levi. Your application is inherently
session based. TCP handles sessions for you (at least at the packet
level). You will end up writing a crappy. bloated, version of TCP by
the time you're done with this project anyway. Why not just use TCP?
Game makers will often use UDP for LAN games because:
A) LANs are reliable
B) Even if there is packet loss, newer packets always have updated
information (such as x,y,z location, etc), so there is no need for an
aggressive, re-transmitting protocol like TCP.
TCP prevents packet loss and is generally "A Good Thing" (tm) when
sending data across the (unreliable) Internet -- hence HTTP being TCP
based even though it is a stateless protocol.
> But I strongly suggest you just use TCP.
Me too.
-Bryan
More information about the PLUG
mailing list