Learn R Programming

svSocket (version 0.9-57)

startSocketServer: Start and stop a R socket server

Description

A R socket server is listening for command send by clients to a TCP port. This server is implemented in Tcl/Tk, using the powerful 'socket' command. Since it runs in the separate tcltk event loop, it is not blocking R, and it runs in the background; the user can still enter commands at the R prompt while one or several R socket servers are running and even, possibly, processing socket clients requests.

Usage

startSocketServer(port = 8888, server.name = "Rserver", procfun = processSocket,
    secure = FALSE, local = !secure)
stopSocketServer(port = 8888)

Arguments

port

the TCP port of the R socket server.

server.name

the internal name of this server.

procfun

the function to use to process client's commands. By default, it is processSocket().

secure

do we start a secure (TLS) server? (not implemented yet)

local

if TRUE, accept only connections from local clients, i.e., from clients with IP address 127.0.0.1. Set by default if the server is not secure.

Details

One can write a different procfun function than the default one for special servers. That function must accept one argument (a string with the command send by the client) and it must return a character string containing the result of the computation.

See Also

processSocket, startHttpServer