Esempio n. 1
0
        static void Main()
        {
            // Запуск одного сервера на каждый процессор
            for (int i = 0; i < Environment.ProcessorCount; i++)
            {
                var pipeServer = new PipeServer();
                pipeServer.InitConnection();
            }

            Console.WriteLine("Press <Enter> to terminate this server application");
            Console.ReadLine();
        }
Esempio n. 2
0
        private void ClientConnected(IAsyncResult result)
        {
            // Клиент присоединен, принимаем другого клиента
            var newPipeServer = new PipeServer();

            newPipeServer.InitConnection();

            // Принятие соединения с клиентом
            _pipeServerStream.EndWaitForConnection(result);

            // Асинхронное чтение запроса со стороны клиента
            var data = new byte[1000];

            _pipeServerStream.BeginRead(data, 0, data.Length, GotRequest, data);
        }