R Under development (unstable) (2023-11-19 r85561 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 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("gtools") > > host <- "www.r-project.org" > host_index <- sprintf("http://%s/index.html", host) > > ## check that network/CRAN are available > rproj_OK <- try(scan(host_index, character(1), quiet = TRUE)) > > if (!inherits(rproj_OK, "try-error")) { + socket <- make.socket(host, 80) + print(socket) + + setTCPNoDelay(socket, TRUE) + + write.socket(socket, sprintf("GET %s\r\n", host_index)) + write.socket(socket, "HOST 127.0.0.1\r\n") + write.socket(socket, "\r\n") + + ## Read and display the response + while ((str <- read.socket(socket)) > "") { + cat(str) + } + + close.socket(socket) + } Socket connection # 756 to on port 80
R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and MacOS. To download R, please choose your preferred CRAN mirror.
If you have questions about R like how to download and install the software, or what the license terms are, please read our answers to frequently asked questions before you send an email.
<div class="loading-spinner"></div>