I'm in a situation where I have a session which gets an ID assigned by it with a simple counter. Well, after a lot of connections the counter will be at 500, even though there might be only 2 people connected. What I want to do is have a counter which flags numbers as free so they are re-usable! I don't have any idea how to tackle this though. I hope one of you might be able to help me out!
public void createSession(Socket gameClient)
{
uint sessionID = mSessionCounter++;
Session Session = new Session(sessionID, gameClient);
mSessions.Add(sessionID, Session);
CommandLine.WriteLine("Created session " + sessionID + " for " + Session.ipAddress, CommandLine.logType.sessionConnectionEvent);
Session.Start();
}