Contains all services for basic message communication between clients and servers.

Connection establishment

When a client initializes it's client daemon it will establish a connection with the server. The connection listener on the serverside runs on a specific port number where it waits for connecting clients. When a clients connects to the listener it is handed a new port number for future communication. The client then closes the connection and establishes a new permanent connection with the server on the new port number. Now the client had a permanent connection and is added to the user database, so messages will be send to and received from this client.
Because a username is not known at the moment, a unique number is used instead.

Message handling

Serverside a message handling thread is started to listen for incoming messages for the clients. It checks for a client whether data is available on that messagestream. If it is available the message is received and handled, otherwise the next user is tried. If a message is received the handling proces will determine what king of message it is, for instance a chatmessage or a gamemessage. It then calls the specific listener for that message, that was previously registerred when the servers where started.
When no listener for that message is registerred the message is discarded.

Database

The {@link quest.server.net.NetUsers} database contains all information about the clients needed for normal message communication. The open messagestream connection with the client is also stored here. @author Merijn Evertse