I am currently writing a server for a fast paced multiplayer game, which should be run in UDP (I read TCP was inappropriate due to the way it handles packet drops, in applications requiring timely delivered data, please correct me if TCP is more useful) The game is not mass multiplayer, and should be hosted primarily by the players themselves, probably on local dedicated servers. While I am pretty sure that the client needs to be in NIO, to avoid game lag from network problems, I do not know how to write the server yet. Here is a list of possibilities I considered:
- Using separate thread for each player with a socket bound to each
- Using one single socket to loop through every player
- Doing the same, but with NIO
- using one socket to broadcast messages to all clients simultaneously
- using one socket for receiving, and one for sending on a separate thread
Which of these is the most appropriate approach to handling time critical data with a relatively low number of clients? (no more than 16)