Created
September 10, 2019 00:15
-
-
Save kapkaev/d51c62d0ebda504925f6c28d0c1e9b97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def findAvailablePort(): Int = { | |
val socket = new ServerSocket(0) | |
socket.setReuseAddress(true) | |
val port = socket.getLocalPort | |
socket.close() | |
port | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment