File: json_rpc_server.Rnw

package info (click to toggle)
r-cran-rjson 0.2.20-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 348 kB
  • sloc: ansic: 636; cpp: 205; makefile: 5; sh: 3
file content (25 lines) | stat: -rw-r--r-- 1,431 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
\documentclass[letter]{article}
%\VignetteIndexEntry{JSON RPC server for R}
%\VignettePackage{rjson}


\begin{document}

\title{JSON RPC server for R}
\author{Alex Couture-Beil}
\maketitle

\section{Introduction}

Remote proceedure calls (RPC) provide inter-process communication which allow programs to call other program's subroutines. JSON-RPC is a RPC protocol built on top of JSON.
JSON-RPC provides a nice way to interface different languages. Sample code for creating an JSON-RPC server for R is supplied with the rjson library. For this example, 
a client wishing to execute R code will first execute a new instance of R, and will communicate over standard IO (stdin/stdout). After the client executes any number of calls, it will terminate the R session with an end of file (ctrl-D).

\section{Sample Code}

Sample code can be found in the {\it ..../library/rjson/rpc\_server} directory. The server is started with {\it ./start\_server} (unix), or with {\it start\_server.bat} (windows). 
An optional paramater specifies a user supplied source file to be loaded by the server, thus allowing the client to execute some user supplied functions.

Note that this code posses serious security risks if the client accecpts input from anyone. (i.e. the client redirects IO from some tcp port to the R json-rpc interface). If this is the case, you'll likely want to avoid allowing anyone to pass anything to eval.

\end{document}