Finds a random available TCP port for listening on, within a specified range of ports. The default range of ports to check is 1024 to 49151, which is the set of TCP User Ports. This function automatically excludes some ports which are considered unsafe by web browsers.
randomPort(min = 1024L, max = 49151L, host = "127.0.0.1", n = 20)
A port that is available to listen on.
if (FALSE) { # \dontrun{
s <- startServer("127.0.0.1", randomPort(), list())
browseURL(paste0("http://127.0.0.1:", s$getPort()))
s$stop()
} # }