freePort {parallelly} | R Documentation |
Find a TCP port that can be opened
Description
Find a TCP port that can be opened
Usage
freePort(
ports = 1024:65535,
default = if (getRversion() >= "4.0.0") NA_integer_ else "random",
randomize = TRUE
)
Arguments
ports |
(integer vector, or character string)
Zero or more TCP ports in [0, 65535] to scan.
If |
default |
(integer) |
randomize |
(logical) If TRUE, |
Value
Returns an integer representing the first port among ports
that
can be opened. If none can be opened, then default
is returned.
If port querying is not supported, as in R (< 4.0.0), then
default
is returned.