Exemplo n.º 1
0
 public void Start()
 {
     VerifyState(HttpServerState.Stopped);
     TimeOutManager = new HttpTimeoutManager(this);
     _tcpListener   = new TcpListener(EndPoint);
     ServerUtility  = new HttpServerUtility();
     State          = HttpServerState.Starting;
     try
     {
         _tcpListener.Start();
         EndPoint = (IPEndPoint)_tcpListener.LocalEndpoint;
         State    = HttpServerState.Started;
         BeginAcceptTcpClient();
     }
     catch
     {
         Console.WriteLine("Server could not start.");
         State = HttpServerState.Stopped;
     }
 }
Exemplo n.º 2
0
 public void Start()
 {
     VerifyState(HttpServerState.Stopped);
     TimeoutManager = new HttpTimeoutManager(this);
     _listener      = new TcpListener(EndPoint);
     ServerUtility  = new HttpServerUtility();
     State          = HttpServerState.Starting;
     try
     {
         _listener.Start();
         EndPoint = _listener.LocalEndpoint as IPEndPoint;
         State    = HttpServerState.Started;
         BeginAcceptTcpClient();
     }
     catch
     {
         Console.WriteLine("The Server failed to start.");
         State = HttpServerState.Stopped;
         throw new PHttpException("Failed to start HTTP server.");
     }
 }