金子邦彦研究室プログラミングR のプログラム例R システムでソケット通信

R システムでソケット通信

関連する外部ページ

R システムの CRAN の URL: https://cran.r-project.org/

  1. サーバの起動
    serv10003 <- function(){
        a <- make.socket("localhost", 10003, server=TRUE)
        on.exit(close.socket(a))
        read.socket(a)
    }
    serv10003()
    

    [image]
  2. 端末を開き,サーバに1行分のデータを送る
    nc 127.0.0.1
    hello
    

    [image]
  3. データが送られてきたことが分かる

    [image]