windows has a long timeout by default but we want to fail fast

This commit is contained in:
Matthew Kennedy 2023-11-04 02:18:10 -07:00
parent 00c6ae115e
commit ada530e2bc
1 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package com.rusefi.io.tcp;
import com.devexperts.logging.Logging;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.Collection;
import java.util.Collections;
@ -73,7 +74,8 @@ public class TcpConnector {
public static boolean isTcpPortOpened() {
long now = System.currentTimeMillis();
try {
Socket s = new Socket(LOCALHOST, DEFAULT_PORT);
Socket s = new Socket();
s.connect(new InetSocketAddress(LOCALHOST, DEFAULT_PORT), 500);
s.close();
return true;
} catch (IOException e) {