Find an available TCP port, starting with port, then sampling from
3000–8000 (excluding ports known to be blocked by Chrome).
Usage
random_port(port = 4321L, n = 20L, exclude = NULL, error = TRUE)
Arguments
- port
Default port to try first.
- n
Number of additional random ports to try.
- exclude
Integer vector of ports to exclude from the search.
- error
Whether to signal an error (default) or return NULL when no
port is found.
Value
An integer port number. When error = TRUE (default), signals an
error if no port is found; when error = FALSE, returns NULL.