diff --git a/ServeMeLib/ServeMe.cs b/ServeMeLib/ServeMe.cs index ee9d982..a05fcd8 100644 --- a/ServeMeLib/ServeMe.cs +++ b/ServeMeLib/ServeMe.cs @@ -394,7 +394,7 @@ internal string CanOpenDefaultBrowserOnStart(string root) } //https://stackoverflow.com/questions/570098/in-c-how-to-check-if-a-tcp-port-is-available - internal bool PortInUse(int port) + internal bool PortNotInUse(int port) { bool isAvailable = true; IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties(); @@ -433,7 +433,7 @@ internal List> GetVariablesFromSettings() if (this.ExtractFromSettings("app sslport", out data) == 2) { int port = int.Parse(data[1]); - if (this.PortInUse(port)) + if (!this.PortNotInUse(port)) throw new Exception($"Ssl Port {port} in setting is in use"); return port; } @@ -446,7 +446,7 @@ internal List> GetVariablesFromSettings() if (this.ExtractFromSettings("app port", out data) == 2) { int port = int.Parse(data[1]); - if (this.PortInUse(port)) + if (!this.PortNotInUse(port)) throw new Exception($"Port {port} in setting is in use"); return port; } diff --git a/ServeMeLib/SimpleHttpServer.cs b/ServeMeLib/SimpleHttpServer.cs index 5feb0ca..1d2201c 100644 --- a/ServeMeLib/SimpleHttpServer.cs +++ b/ServeMeLib/SimpleHttpServer.cs @@ -145,11 +145,11 @@ public SimpleHttpServer(ServeMe serveMe, int? port = null, int? portHttps = null } if (portHttps == null) { - var allowableHttpsPortsByVisualStudio = Enumerable.Range(44300, 33399).ToList(); + var allowableHttpsPortsByVisualStudio = Enumerable.Range(44300, 44399).ToList(); for (int i = 0; i < allowableHttpsPortsByVisualStudio.Count; i++) { - if (!serveMe.PortInUse(allowableHttpsPortsByVisualStudio[i])) + if (serveMe.PortNotInUse(allowableHttpsPortsByVisualStudio[i])) { portHttps = allowableHttpsPortsByVisualStudio[i]; serveMe.Log($"Yay! Found https port {portHttps} to use ....");