| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/random_port.r |
| 3 |
\name{random_port} |
| 4 |
\alias{random_port} |
| 5 |
\alias{random_open_port} |
| 6 |
\title{Random Port} |
| 7 |
\usage{ |
| 8 |
random_port(min_port = 49152, max_port = 65536) |
| 9 |
|
| 10 |
random_open_port(min_port = 49152, max_port = 65536, max_tries = 100) |
| 11 |
} |
| 12 |
\arguments{ |
| 13 |
\item{min_port, max_port}{The minimum/maximum value to be generated. The minimum should not |
| 14 |
be below 49152 and the maximum should not exceed 65536 (see |
| 15 |
details).} |
| 16 |
|
| 17 |
\item{max_tries}{The maximum number of times a random port will be searched for.} |
| 18 |
} |
| 19 |
\description{ |
| 20 |
Generate a valid, random TCP port. |
| 21 |
} |
| 22 |
\details{ |
| 23 |
By definition, a TCP port is an unsigned short, and so it can not |
| 24 |
exceed 65535. Additionally, ports in the range 1024 to 49151 are |
| 25 |
(possibly) registered by ICANN for specific uses. |
| 26 |
|
| 27 |
\code{random_port()} will simply generate a valid, non-registered |
| 28 |
tcp port. \code{random_unused_port()} will generate a port |
| 29 |
that is available for socket connections. |
| 30 |
|
| 31 |
\code{random_open_port()} finds a random port not already bound |
| 32 |
to an endpoint. |
| 33 |
} |
| 34 |
\examples{ |
| 35 |
random_port() |
| 36 |
|
| 37 |
} |
| 38 |
\references{ |
| 39 |
"The Ephemeral Port Range" by Mike Gleason. |
| 40 |
\url{https://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html} |
| 41 |
} |
| 42 |
\author{ |
| 43 |
Drew Schmidt |
| 44 |
} |