Version: | 0.7.1 |
Imports: | utils |
Suggests: | tools, rmarkdown, knitr |
VignetteBuilder: | knitr |
Title: | Get the Same, Personal, Free 'TCP' Port over and over |
Description: | An R implementation of the cross-platform, language-independent "port4me" algorithm (https://github.com/HenrikBengtsson/port4me), which (1) finds a free Transmission Control Protocol ('TCP') port in [1024,65535] that the user can open, (2) is designed to work in multi-user environments, (3), gives different users, different ports, (4) gives the user the same port over time with high probability, (5) gives different ports for different software tools, and (6) requires no configuration. |
License: | MIT + file LICENSE |
URL: | https://github.com/HenrikBengtsson/port4me |
BugReports: | https://github.com/HenrikBengtsson/port4me/issues |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.1 |
NeedsCompilation: | yes |
Packaged: | 2024-02-29 23:12:25 UTC; henrik |
Author: | Henrik Bengtsson |
Maintainer: | Henrik Bengtsson <henrikb@braju.com> |
Repository: | CRAN |
Date/Publication: | 2024-03-01 00:00:02 UTC |
Gets a Personalized TCP Port that can be Opened by the User
Description
Gets a Personalized TCP Port that can be Opened by the User
Usage
port4me(
tool = NULL,
user = NULL,
prepend = NULL,
include = NULL,
exclude = NULL,
skip = NULL,
list = NULL,
test = NULL,
max_tries = 65535L,
must_work = TRUE
)
Arguments
tool |
(optional) The name of the software tool for which a port should be generated. |
user |
(optional) The name of the user.
Defaults to |
prepend |
(optional) An integer vector of ports to always consider. |
include |
(optional) An integer vector of possible ports to return.
Defaults to |
exclude |
(optional) An integer vector of ports to exclude. |
skip |
(optional) Number of non-excluded ports to skip.
Defaults to |
list |
(optional) Number of ports to list. |
test |
(optional) A port to check whether it can be opened or not. |
max_tries |
Maximum number of ports checked, before giving up.
Defaults to |
must_work |
If TRUE, then an error is produced if no port could
be found. If FALSE, then |
Value
A port, or a vector of ports.
If test
is given, then TRUE is if the port can be opened, otherwise FALSE.
See Also
The default values of the arguments can be controlled via environment variables. See port4me.settings for details.
Examples
port <- port4me()
print(port)
port <- port4me(tool = "rstudio")
print(port)
port <- port4me("rstudio") ## short for the above
print(port)
ports <- port4me(tool = "rstudio", list = 5L)
print(ports)
avail <- port4me(test = 4321)
print(avail)
Settings Used by the 'port4me' Package
Description
Below are the environment variables that are used by the port4me
package and packages enhancing it.
WARNING: Note that the names and the default values of these settings
may change in future versions of the package. Please use with care
until further notice.
Details
PORT4ME_EXCLUDE
:-
Controls the default value for argument
exclude
ofport4me()
. Ports and port sequences should be separated by commas. Port sequences should be specified as a start and end port separated by a hyphen. Example:PORT4ME_EXCLUDE=4444,5000-5999,8080
. (Default: empty) PORT4ME_INCLUDE
:-
Controls the default value for argument
include
ofport4me()
. The format should be the same as forPORT4ME_INCLUDE
. (Default: empty) PORT4ME_PREPEND
:-
Controls the default value for argument
prepend
ofport4me()
. The format should be the same as forPORT4ME_INCLUDE
. (Default: empty) PORT4ME_SKIP
:-
Controls the default value for argument
skip
ofport4me()
. (Default:0
) PORT4ME_TOOL
:-
Controls the default value for argument
tool
ofport4me()
. (Default: empty) PORT4ME_USER
:-
Controls the default value for argument
user
ofport4me()
. (Default:Sys.info()[["user"]])
)
Site-wide and built-in settings
PORT4ME_EXCLUDE_SITE
,PORT4ME_INCLUDE_SITE
,PORT4ME_PREPEND_SITE
:-
Additional sets of ports to be excluded, included, and prepended. These are typically set for all users ("site wide") by a systems administrator or similar. (Default: empty)
PORT4ME_EXCLUDE_UNSAFE
:-
Additional sets of ports to be excluded that are considered unsafe to open in a web browser. Special token
"{chrome}"
expands to the value of environment variablePORT4ME_EXCLUDE_UNSAFE_CHROME
. Special token"{firefox}"
expands to the value of environment variablePORT4ME_EXCLUDE_UNSAFE_FIREFOX
. The default is to exclude the ports that Chrome and Firefox blocks. (Default:"{chrome},{firefox}"
) PORT4ME_EXCLUDE_UNSAFE_CHROME
:-
The set of ports that the Chrome web browser considers unsafe and therefore blocks. (Default: ports blocked by Chrome)
PORT4ME_EXCLUDE_UNSAFE_FIREFOX
:-
The set of ports that the Firefox web browser considers unsafe and therefore blocks. (Default: ports blocked by Firefox)
Settings for debugging
PORT4ME_DEBUG
:-
If
true
, extensive debug messages are generated. (Default:false
)
See Also
Environment variables can be configured for R, by setting them in
your personal ~/.Renviron
file, e.g.
PORT4ME_EXCLUDE=4848,8080
For more information, see the Startup help page.
Examples
Sys.setenv(PORT4ME_EXCLUDE = "4444,5000-5999,8080")
port4me()