// Keeps listening for incoming connections. For each connection, it spins up a KettleSession with his own simulator. public void Enter() { while (true) { Socket client = Listener.Accept(); Console.WriteLine("Accepted client"); try { // For now we run each session in a new thread. If/when the server needs to scale to tens/hundreds of games, this should be changed //KettleSessionTest session = new KettleSessionTest(client); KettleSession session = new KettleSession(client); new Thread(session.Enter).Start(); } catch (IOException) { Console.WriteLine("Connection closed"); } } }
public KettleAISession(KettleSession session, KettleStartClient startClient) { this.StartClient = startClient; this.Session = session; }