R Under development (unstable) (2024-02-28 r85999 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(port4me) > > is_tcp_port_available <- port4me:::is_tcp_port_available > initialize_internet <- port4me:::initialize_internet > parse_cli_args <- port4me:::parse_cli_args > > # -------------------------------------------------------- > # is_tcp_port_available() and initialize_internet() > # -------------------------------------------------------- > Sys.setenv("_PORT4ME_CHECK_AVAILABLE_PORTS_" = "") > res <- tryCatch({ + is_tcp_port_available(1024) + }, error = identity) > stopifnot(inherits(res, "error")) > Sys.unsetenv("_PORT4ME_CHECK_AVAILABLE_PORTS_") > > env <- environment(initialize_internet) > env[["done"]] <- FALSE > initialize_internet() > > env <- environment(initialize_internet) > env[["done"]] <- FALSE > env[["baseenv"]] <- emptyenv() > initialize_internet() Warning message: In socketConnection(port = 0L, server = FALSE, blocking = FALSE, : localhost:0 cannot be opened > > > # -------------------------------------------------------- > # Test unloading package > # -------------------------------------------------------- > unloadNamespace("port4me") > > > proc.time() user system elapsed 0.10 0.06 0.17