diff --git a/server/src/main/java/com/genymobile/scrcpy/DesktopConnection.java b/server/src/main/java/com/genymobile/scrcpy/DesktopConnection.java index 24735f78..d5740c15 100644 --- a/server/src/main/java/com/genymobile/scrcpy/DesktopConnection.java +++ b/server/src/main/java/com/genymobile/scrcpy/DesktopConnection.java @@ -36,7 +36,11 @@ public final class DesktopConnection implements Closeable { private static LocalSocket listenAndAccept(String abstractName) throws IOException { LocalServerSocket localServerSocket = new LocalServerSocket(abstractName); - return localServerSocket.accept(); + try { + return localServerSocket.accept(); + } finally { + localServerSocket.close(); + } } public static DesktopConnection open(Device device, boolean tunnelForward) throws IOException {