Ejemplo n.º 1
0
        } = true;                                       //TODO: Setup an actual controlled flag for this.

        public void RunServer()
        {
            orionLogger.LogMessage(StartUpMessage);
            tcpListenerWrapper.Start();

            while (ServerRunning)
            {
                orionLogger.LogMessage(ReadyForConnectionMessage);
                tcpListenerWrapper.AcceptTcpClient();

                ServerRunning = false; //Only to run test once. (For now until implementation is complete)
            }
        }
Ejemplo n.º 2
0
 protected void Listen()
 {
     listener.Start();
     while (true)
     {
         ITcpClientWrapper tcpClient;
         try
         {
             tcpClient = listener.AcceptTcpClient();
         }
         catch (SocketException)
         {
             // "Необработанное исключение типа "System.Net.Sockets.SocketException" в System.dll
             // Дополнительные сведения: Операция блокирования прервана вызовом WSACancelBlockingCall"
             // при закрытии приложения
             break;
         }
         var processor = httpProcessorFactory.GetHttpProcessor(tcpClient, streamFactory, HandleGETRequest, HandlePOSTRequest);
         var thread    = new Thread(processor.Process);
         thread.Start();
         Thread.Sleep(1);
     }
 }