Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            _server = new TcpSocketServer("127.0.0.1", 6666);

            _server.OnAcceptCompletedEvent += Server_OnAcceptCompletedEvent;

            _server.OnCloseCompletedEvent += Server_OnCloseCompletedEvent;

            _server.OnDisconnectClientCompletedEvent += Server_OnDisconnectClientCompletedEvent;

            _server.OnReceiveCompletedEvent += Server_OnReceiveCompletedEvent;

            _server.OnSendCompletedEvent += Server_OnSendCompletedEvent;

            _server.Start();

            Console.WriteLine("Start server ...");

            while (true)
            {
                string val = Console.ReadLine();

                if (val == "exit")
                {
                    _server.Close();

                    break;
                }

                _server.SendAll(Encoding.UTF8.GetBytes(val));
            }
        }