Skip to content

Instantly share code, notes, and snippets.

@90K2
Created August 18, 2022 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 90K2/c989dbb786c51831d7b739f7dfae1f35 to your computer and use it in GitHub Desktop.
Save 90K2/c989dbb786c51831d7b739f7dfae1f35 to your computer and use it in GitHub Desktop.
check whether is host port available or not
private fun isHostAvailable(ip: Int, port: Int): Boolean {
return kotlin.runCatching {
Socket(Utils.ipv4IntToStr(ip), port)
true
}.getOrNull() ?: false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment