Skip to content

Commit f272844

Browse files
Only check for active TCP connections on Windows
1 parent 6d3b9fb commit f272844

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ASCOM.Alpaca.Simulators/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ public static void Main(string[] args)
4747
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
4848
{
4949
//Already running, start the browser, detects based on port in use
50-
if (IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections().Any(con => con.LocalEndPoint.Port == ServerSettings.ServerPort))
50+
var con1 = IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections().Where(con => con.LocalEndPoint.Port == ServerSettings.ServerPort);
51+
if (IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections().Any(con => con.LocalEndPoint.Port == ServerSettings.ServerPort && (con.State == TcpState.Listen || con.State == TcpState.Established)))
5152
{
5253
WriteAndLog("Detected driver port already open, starting web browser on IP and Port. If this fails something else is using the port");
5354
StartBrowser(ServerSettings.ServerPort);

0 commit comments

Comments
 (0)