public void ConfigureAndStart()
        {
            int    port             = Port;
            String networkIpAddress = Utils.GetLocalIP();
            String address1         = string.Format("http://localhost:{0}/", port);
            String address2         = string.Format("http://127.0.0.1:{0}/", port);
            String address3         = string.Format("http://{0}:{1}/", networkIpAddress, port);


            if (Utils.IsRunningAsAdministrator())
            {
                server = new HttpServer(address1, address2, address3);
            }
            else
            {
                server = new HttpServer(address1, address2);
            }


            server.AddHttpRequestHandler(new ReplacePrinterWordHttpRequestHandler());
            server.AddHttpRequestHandler(new ListPrintersHttpRequestHandler());
            server.AddHttpRequestHandler(new TestHttpRequestHandler());
            server.AddHttpRequestHandler(new DocsModelsHttpRequestHandler());
            server.Start();
        }
Example #2
0
    void CreateServer()
    {
        _server = new HttpServer("http://*:" + _settings.Port + "/");

        // Add the HttpRequestHandlers
        _server.AddHttpRequestHandler(new DataHttpRequestHandler(this));
        _server.AddHttpRequestHandler(new AuthHttpRequestHandler(_deviceManager));
        _server.AddHttpRequestHandler(new AuthEnabledHttpRequesthandler(_deviceManager));
        _server.AddHttpRequestHandler(new RegisterHttpRequestHandler(_deviceManager));
        _server.AddHttpRequestHandler(new InvalidHttpRequestHandler());
    }
Example #3
0
        public static void Main(string[] args)
        {
            var server = new HttpServer("http://*:12345/");

            server.AddHttpRequestHandler(new MainPageHttpRequestHandler());
            server.AddHttpRequestHandler(new ConnectionSettingsHttpRequestHandler());
            server.AddHttpRequestHandler(new SendMessageHttpRequestHandler());
            server.AddHttpRequestHandler(new GetLogsHttpRequestHandler());

            server.Start();
            Console.ReadKey();
            server.Stop();
        }
Example #4
0
        static void Main(string[] args)
        {
            // Set up and run the server
            HttpServer server = new HttpServer(8000);

            server.AddHttpRequestHandler(
                "/",
                new HttpResourceHandler(
                    Utilities.GetContainingAssembly(typeof(Program)),
                    "Resources.Site",
                    "index.html"
                    )
                );
            server.AddWebSocketRequestHandler(
                "/sockets/",
                new WebSocketHandler()
                );
            server.Start();
            Console.WriteLine("Server running - press any key to stop.");
            while (!Console.KeyAvailable)
            {
                Thread.Sleep(100);
            }
            Console.ReadKey();
        }
Example #5
0
        public Server(MondRemoteDebugger debugger, int port)
        {
            _server = new HttpServer(port);

            var assembly = GetType().GetTypeInfo().Assembly;

            _server.AddHttpRequestHandler("/",
                                          new HttpResourceHandler(assembly, "DebuggerClient", "index.html"));

            _sessionMgr = new SessionManager(debugger);
            _server.AddWebSocketRequestHandler("/", _sessionMgr);

            _server.Start();
        }
Example #6
0
        public void StartAll()
        {
            Sockets = new List <WebSocket>();

            webServer = new HttpServer(8006);
            webServer.AddHttpRequestHandler(
                "/",
                new HttpResourceHandler(
                    Utilities.GetContainingAssembly(typeof(WebController)),
                    "Resources.Site",
                    "index.html"
                    )
                );
            webServer.AddWebSocketRequestHandler(
                "/sockets/",
                new WebSocketHandler()
                );

            webServer.Start();
            var Ip = Utils.GetLocalIp();

            gameBrain.Debug("Web server oppened at " + Ip + ":8006", true);
        }
Example #7
0
        public MainPage()
        {
            this.InitializeComponent();

            initSensors();

            // myBT.Connect();

            try
            {
                server1.AddHttpRequestHandler("/", new myHandler());
                server1.AddWebSocketRequestHandler(
                    "/sockets/",
                    mySocket
                    );
                server1.Start();
                mySocket.ConnectedEvent += WSConn;
            }
            catch (Exception ex)
            {
                var tt = ex;
                throw;
            }
        }
Example #8
0
    void CreateServer()
    {
        _server = new HttpServer("http://*:" + _settings.Port + "/");

        // Add the HttpRequestHandlers
        _server.AddHttpRequestHandler(new DataHttpRequestHandler(this));
        _server.AddHttpRequestHandler(new AuthHttpRequestHandler(_deviceManager));
        _server.AddHttpRequestHandler(new AuthEnabledHttpRequesthandler(_deviceManager));
        _server.AddHttpRequestHandler(new RegisterHttpRequestHandler(_deviceManager));
        _server.AddHttpRequestHandler(new InvalidHttpRequestHandler());
    }
Example #9
0
        static void Main(string[] args)
        {
            int port = 0;

            if (args.Length > 0)
            {
                int.TryParse(args[0], out port);
            }

            if (port <= 0)
            {
                MessageBox.Show("Please supply a port paramater that is within the valid range.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string namedPipeCustom = string.Empty;
            //if (args.Length > 1)
            //{
            //    namedPipeCustom = args[1].Trim();
            //}

            //if(port == 0)
            {
                MenuItem mExit = new MenuItem("Exit", new EventHandler(Exit));
                MenuItem mPort = new MenuItem($"Port: {port}");
                mPort.Enabled = false;
                ContextMenu Menu = new ContextMenu(new MenuItem[] { mExit, mPort });

                Tray = new NotifyIcon()
                {
                    Icon        = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location),
                    Visible     = true,
                    Text        = "Carbyne Steam Interop Server",
                    ContextMenu = Menu
                };
            }

            SteamContext context = SteamContext.GetInstance();

            context.Init();


            //OnEventRaisedSocketHandler = new WebSocketHandler();
            FunctionHttpHandler = new HttpHandler(context);

            server = new HttpServer(port);

            server.AddHttpRequestHandler(
                "/",
                FunctionHttpHandler
                );

            //server.AddWebSocketRequestHandler(
            //    "/OnEventRaised/",
            //    OnEventRaisedSocketHandler
            //);

            server.Start();

            Application.Run();

            /*while (!poison)
             * {
             *  Thread.Sleep(1000);
             * }*/

            server.Stop();
            if (context != null)
            {
                context.Shutdown();
            }

            if (Tray != null)
            {
                Tray.Dispose();
            }
        }