Пример #1
0
        static void Main(string[] args)
        {
            var server           = new Server("127.0.0.1", 1664, Environment.ProcessorCount);
            int connectedClients = 0;

            server.OnServerStarted += (o, e) => {
                Console.WriteLine("Server starded, waiting for clients...");
            };

            server.OnClientConnected += (o, e) => {
                connectedClients++;
                Console.WriteLine($"Clients: {connectedClients}");
            };

            server.OnClientDisconnected += (o, e) => {
                connectedClients--;
                Console.WriteLine($"Clients: {connectedClients}");
            };

            server.StartUniqueClientType <DemoTcpClientSavedState>();
        }