Esempio n. 1
0
    } // end public void stop()

    // Action body for _connectionThread
    private void ConnectionThreadStart() {
        try {
            while (_running) {
                // Grab the context and pass it to the HttpResourceLocator to handle it
                HttpListenerContext context = _httpListener.GetContext();
                _resourceLocator.HandleContext(context);

            } // while running
        } catch (HttpListenerException) {
            // This will occurs when the listener gets shutdown.
            Console.WriteLine("HTTP server was shut down.");
        } // end try-catch

    } // end private void connectionThreadStart()
Esempio n. 2
0
 private void ConnectionThreadStart()
 {
     try
     {
         while (isRunning)
         {
             HttpListenerContext context = listener.GetContext();
             resourceLocator.HandleContext(context);
         }
     }
     catch (Exception)
     {
         Console.WriteLine("Exception thrown from the server");
     }
 }