Start() public method

public Start ( ) : void
return void
 public HttpServer()
 {
     nServer.RequestReceived += nServer_RequestReceived;
     nServer.Start();
     port = nServer.EndPoint.Port;
     log.InfoFormat("Successfully setup HttpServer on port {0}.", port);
 }
Example #2
0
        public HelpServer()
        {
            Manager = new HelpManager();

            _server = new HttpServer();
            _server.RequestReceived += _server_RequestReceived;
            _server.UnhandledException += _server_UnhandledException;
            _server.Start();
        }
Example #3
0
 public void startListening(String cmd, String[] wpad_exclude)
 {
     NHttp.HttpServer server = new NHttp.HttpServer();
     this.cmd                = cmd;
     this.wpad_exclude       = wpad_exclude;
     server.EndPoint         = new IPEndPoint(IPAddress.Loopback, 80);
     server.RequestReceived += recvRequest;
     server.Start();
     Console.WriteLine("Listening...");
     while (true)
     {
         Thread.Sleep(5000);
     }
 }
Example #4
0
        public void StartHttpServer()
        {
            int port = WSRConfig.GetInstance().loopback;

              // 192.168.0.x
              http = new HttpServer();
              http.EndPoint = new IPEndPoint(GetIpAddress(), port);
              http.RequestReceived += this.http_RequestReceived;
              http.Start();
              WSRConfig.GetInstance().logInfo("INIT", "Starting Server: http://" + http.EndPoint + "/");

              // Localhost
              httpLocal = new HttpServer();
              httpLocal.EndPoint = new IPEndPoint(IPAddress.Loopback, port);
              httpLocal.RequestReceived += this.http_RequestReceived;
              httpLocal.Start();
              WSRConfig.GetInstance().logInfo("INIT", "Starting Server: http://" + httpLocal.EndPoint + "/");
        }
Example #5
0
        public void SetupFakeServer()
        {
            loginSettingsRepository = Resolve<LoginSettingsRepository>();

            server = new HttpServer();
            server.RequestReceived += (s, e) =>
            {
                using (var writer = new StreamWriter(e.Response.OutputStream))
                {
                    var path = e.Request.RawUrl;
                    var response = responses.First(r => r.Path == path);
                    
                    Console.WriteLine("Received request {0}", path);

                    if (response == null)
                    {
                        if (path != FaviconPath)
                            unhandledResponses.Add(path);
                    }
                    else
                    {
                        if (response.IsSatisfied(e))
                        {
                            responses.Remove(response);
                            Console.WriteLine(response.ResponseText);
                            writer.Write(response.ResponseText);
                        }                        
                    }                    
                }
            };

            //Use port zero - this way the OS will assign a free port and we can avoid collisions
            server.EndPoint = new IPEndPoint(IPAddress.Loopback, 0);
            server.Start();

            Console.WriteLine("Starting server at {0}", server.EndPoint);

            //Update login settings so that they match the server URL
            UpdateLoginSettings(server.EndPoint.ToString());
        }
    public void StartHttpServer() {

      int port = ConfigManager.GetInstance().Find("http.local.port", 8888);
      IPAddress address = GetIpAddress();

      // 192.168.0.x
      if (address != null) {
        try {
          http = new HttpServer();
          http.EndPoint = new IPEndPoint(address, port);
          http.Start();
          http.RequestReceived += this.http_RequestReceived;
          Log("Starting Server: http://" + http.EndPoint + "/");
        } catch (Exception ex) {
          http = null;
          Log("Exception: " + ex.Message);
        }
      }

      // Localhost
      try {
        local = new HttpServer();
        local.EndPoint = new IPEndPoint(IPAddress.Loopback, port);
        local.RequestReceived += this.http_RequestReceived;
        local.Start();
        Log("Starting Server: http://" + local.EndPoint + "/");
      } catch (Exception ex) {
        local = null;
        Log("Exception: " + ex.Message);
      }
    }
Example #7
0
 public void startListening(String cmd,String[] wpad_exclude)
 {
     NHttp.HttpServer server = new NHttp.HttpServer();
     this.cmd = cmd;
     this.wpad_exclude = wpad_exclude;
     server.EndPoint = new IPEndPoint(IPAddress.Loopback, 80);
     server.RequestReceived += recvRequest;
     server.Start();
     Console.WriteLine("Listening...");
     while (true)
     {
         Thread.Sleep(5000);
     }
 }
        public Task<string> ListenForIncomingShopTokenFromRedirect(int port)
        {
            var tcs = new TaskCompletionSource<string> ();
            Server = new HttpServer ();

            Server.EndPoint.Port = port;
            Server.EndPoint.Address = IPAddress.Any;
            Server.RequestReceived += (s, e) =>
            {
                using (var writer = new StreamWriter(e.Response.OutputStream)) {
                    writer.Write ("Nom, delicious shop access code!  Test suite will now continue.");
                }

                // when we get our first request, have the TCS become ready
                tcs.SetResult (e.Request.Params ["code"]);
                // server.Dispose();
            };

            Server.Start ();

            return tcs.Task;
        }
        public void StartHttpServer()
        {
            int port = WSRConfig.GetInstance().loopback;

              // 192.168.0.x
              try {
            http = new HttpServer();
            http.EndPoint = new IPEndPoint(GetIpAddress(), port);
            http.Start();
            http.RequestReceived += this.http_RequestReceived;
            WSRConfig.GetInstance().logInfo("INIT", "Starting Server: http://" + http.EndPoint + "/");
              }
              catch (Exception ex) {
            http = null;
            WSRConfig.GetInstance().logInfo("HTTP", "Exception: " + ex.Message);
              }

              // Localhost
              httpLocal = new HttpServer();
              httpLocal.EndPoint = new IPEndPoint(IPAddress.Loopback, port);
              httpLocal.RequestReceived += this.http_RequestReceived;
              httpLocal.Start();
              WSRConfig.GetInstance().logInfo("INIT", "Starting Server: http://" + httpLocal.EndPoint + "/");
        }
Example #10
0
 public void Start()
 {
     server.Start();
 }
Example #11
0
        public void StartHttpServer()
        {
            int port = ConfigManager.GetInstance().Find("http.local.port", 8888);
              List<IPAddress> addresses;

              string configIps = ConfigManager.GetInstance().Find("http.local.ip", "");
              if (String.IsNullOrWhiteSpace(configIps)) {
             addresses.Add(GetIpAddress());
              }
              else {
            string[] ips = configIps.Split(",");
            try {
              foreach(string ip in ips) {
            addresses.Add(IPAddress.Parse(ip));
              }
            } catch(Exception ex) {
              Log("Exception: " + ex.Message);
            }
              }

              foreach(IPAddress address in addresses) {
            // 192.168.0.x
            if (address != null) {
              try {
            http = new HttpServer();
            http.EndPoint = new IPEndPoint(address, port);
            http.Start();
            http.RequestReceived += this.http_RequestReceived;
            Log("Starting Server: http://" + http.EndPoint + "/");
              } catch (Exception ex) {
            http = null;
            Log("Exception: " + ex.Message);
              }
            }
              }

              // Localhost
              try {
            local = new HttpServer();
            local.EndPoint = new IPEndPoint(IPAddress.Loopback, port);
            local.RequestReceived += this.http_RequestReceived;
            local.Start();
            Log("Starting Server: http://" + local.EndPoint + "/");
              } catch (Exception ex) {
            local = null;
            Log("Exception: " + ex.Message);
              }
        }
Example #12
0
        public void startListening(String cmd,String[] wpad_exclude,int port)
        {

            NHttp.HttpServer server = new NHttp.HttpServer();
            this.cmd = cmd;
            this.wpad_exclude = wpad_exclude;
<<<<<<< HEAD
            this.srvPort = port;
=======
>>>>>>> a80fdfbf7cbef7ae601d584bf185afc7c211099c
            server.EndPoint = new IPEndPoint(IPAddress.Loopback, port);
            server.RequestReceived += recvRequest;
            server.Start();
            Console.WriteLine("Listening...");
            while (true)
            {
                Thread.Sleep(5000);
            }
        }