My plans for this server don't require very much message traffic, but I wanted to know it could handle what ever I plan on throwing at it.
Every message that is sent is prefaced with how much data is in the message, so there is no need to add "
The buffers are 1024 bytes (1Kb) using a const that can be changed if needed, and if a message is sent longer than this, the receiving side will simply make another read callback until all of the message is received.
Each connection to the server, uses an internal ID system:
class Connection
{
....
private static int LastID;
private static Queue
private int getID()
{
if(unusedID.Count > 0)
return unusedID.dequeue();
else
return ++LastID;
}
......
private int myID;
public int ID
{
get{return myID;}
}
....
public Connection()
{
myID = getID();
....
}
private ~Connection()
{
unusedID.Enqueue(myID);
myID = 0;
....
}
....
}