Displaying 1 result from an estimated 1 matches for "portsinus".
Did you mean:
portsinuse
2005 Apr 14
0
Finding an available port for server socket
...ngs, host, port){
## open a blocking client socket, put strings on it, and close
outConn <- socketConnection(host, port, blocking = T)
writeLines(strings, outConn)
close(outConn)
}
availablePort <- function(){
## find a port that R can listen on
## just returns 40001 on Windows
portsInUse <- 0
os <- as.vector(Sys.info()["sysname"])
if(os == "Linux"){
hexTcp <- system("cat /proc/net/tcp | awk '{print $2}'", intern = T)
hexUdp <- system("cat /proc/net/udp | awk '{print $2}'", intern = T)
portsInUse &l...