static void Main() { Console.WriteLine("CardGameServer started on port " + Settings.Port); server = new Server(); server.ClientConnected += endPoint => Console.WriteLine("Client connected: " + endPoint); server.ClientDisconnected += endPoint => Console.WriteLine("Client disconnected: " + endPoint); server.ClientMessageReceived += MessageReceived; Console.WriteLine("Press any key to exit ..."); Console.ReadKey(); }
static void Main() { Console.WriteLine("PongServer started on port " + Settings.Port); server = new Server(); server.ClientConnected += endPoint => { if (server.clients.Count == 2) StartGame(); }; server.ClientMessageReceived += PaddlePositionMessageReceived; Console.WriteLine("Press any key to exit ..."); Console.ReadKey(); }
private static void Main() { Console.WriteLine("PongServer started on port " + Settings.Port); database = new Database(); server = new Server(); server.ClientConnected += endPoint => { lock (database) database.LoginPlayer(endPoint.ToString()); if (server.clients.Count == 2) StartGame(); }; server.ClientMessageReceived += PaddlePositionMessageReceived; Console.WriteLine("Press any key to exit ..."); Console.ReadKey(); }