Learn R Programming

fame (version 1.13)

availablePort: Find Available TCP Port or Ports In Use

Description

portsInUse returns a vector of UDP and TCP port numbers currently being used by the operating system. Under Linux, these are the ports listed in /proc/net/[u|t]cp, while for Windows they are the ports listed by netstat -an.

Under either operating system, availablePort returns the first TCP port number greater than 40000 that is not currenly in use.

Usage

portsInUse()
availablePort()

Arguments

Value

  • portsInUse returns a numeric vector. availablePort returns an integer.

See Also

hostName