コード例 #1
0
        /// <summary>
        /// Start the server by starting the HTTP server, the websocket server and the media detector.
        /// </summary>
        /// <returns>true when the server was successfully started</returns>
        public bool Start()
        {
            // Start HTTP server
            try {
                Log("Starting HTTP server on port " + _httpServerPort.ToString());
                _httpServer = new Server.Http.HttpServer(_httpServerPort);
                _httpServer.Start();
                Log("HTTP server started");
            }
            catch (Exception e) {
                Log("Could not start HTTP server", e, Logger.LogLevel.Fatal);
                return(false);
            }

            // Start websocket server
            try {
                Log("Starting websocket server on port " + this.WebsocketPort.ToString());
                _websocketServer = new Server.Websocket.WebsocketServer(this.WebsocketPort);
                _websocketServer.Start();
                Log("Websocket server started");
            }
            catch (Exception e)
            {
                Log("Could not start websocket server", e, Logger.LogLevel.Fatal);
                return(false);
            }

            return(true);
        }
コード例 #2
0
        /// <summary>
        /// Start the server by starting the HTTP server, the websocket server and the media detector.
        /// </summary>
        /// <returns>true when the server was successfully started</returns>
        public bool Start()
        {
            // Start HTTP server
            try {
                Log("Starting HTTP server on port " + _httpServerPort.ToString());
                _httpServer = new Server.Http.HttpServer(_httpServerPort);
                _httpServer.Start();
                Log("HTTP server started");
            }
            catch (Exception e) {
                Log("Could not start HTTP server", e, Logger.LogLevel.Fatal);
                return false;
            }

            // Start websocket server
            try {
                Log("Starting websocket server on port " + this.WebsocketPort.ToString());
                _websocketServer = new Server.Websocket.WebsocketServer(this.WebsocketPort);
                _websocketServer.Start();
                Log("Websocket server started");
            }
            catch (Exception e)
            {
                Log("Could not start websocket server", e, Logger.LogLevel.Fatal);
                return false;
            }

            return true;
        }