Wow! Something I can actually comment on!
Apologises in advance for the long post,
I recently wrote a light cycle game in Java3D which is network playable. I originally based the whole thing on TCP. On my local machine there was no problem, across the LAN it was a little slow, across the internet is was really bad.
With a little investigation I found that the real problem with using TCP for anything performance related is the send/recieve buffers on the IP stacks. TCP won’t send an IP datagram until the send buffer is full. So you’ll get little blasts of data going across the net. Athough you can reconfigure this on the local machine, the further you go across the net the more stacks you go up and down. This seems to be referred to as latency.
I moved over to UDP and suddenly I could get decent pings between my client and server.
I’ve actuall written an API over the top of UDP that supports “Message” objects. These can be sent across UDP in a TCP like manner. The API uses the strategy pattern to support being able to plugin different type of UDP handle, e.g. GuaranteedDelivery, IgnoreLoss, ResequenceOnly
If anyones interested in the API drop me a mail.
Interesting thing was that even when I simulated TCP across UDP, i.e. GuaranteedDelivery using ACK messages, I got a far better performance. I guess what it comes down to is that using UDP you have a real control over when an IP packet is sent.
Apologies again for the long message,
Kev
EDIT: Incidently, the API is based on NIO