Exemplo n.º 1
0
        private void StartWebServer()
        {
            UpdateHTTPServerInfo();
            if (NetHelpers.CheckPortIsFree(_ipAddress, _httpServerPort))
            {
                _httpServerThread = new Thread(() => HTTPServerThread(_telemetryData, _timingData, _ipAddress, _httpServerPort, _httpServerPath, _plugins));
                _httpServerThread.Start();
                UpdateHTTPServerInfo();
            }
            else
            {
                string processName = "Unknown";
                Port   process     = NetHelpers.FindProcessUsingPort(_httpServerPort);
                if (process != null)
                {
                    processName = process.process_name;
                }

                MessageBox.Show("Unable to start the HTTP Server. The specified port (" + _httpServerPort.ToString() + ") is already in use by " + processName + ".", "HTTP Server", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }