SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: Tcl Rclient for Rserve [ Reply ]
By: Philippe Grosjean on 2018-01-30 07:58
[forum:45603]
On MacOS (El Capitan) with R 3.3.2 -yes, I know, not the latest ones!) I got:

- in server.R:

library(svSocket)
status <- startSocketServer(port = 8888, local = TRUE, secure = FALSE)
while (1) {
Sys.sleep(0.5)
}

then in a terminal:

$ Rscript server.R &
[1] 88502
$ ps
PID TTY TIME CMD
73476 ttys001 0:00.78 -bash
88502 ttys001 0:00.23 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave --no-restore --file=server.R

- In a separate client R process, I can do something like:

library(svSocket)
con <- socketConnection(host = "localhost", port = 8888, blocking = FALSE)
evalServer(con, "x <- 42") # Set x
## [1] 42
evalServer(con, "y <- 10") # Set y
## [1] 10
evalServer(con, x + y) # Don't need quotes here
## [1] 52
close(con)

Best,

Philippe Grosjean

RE: Tcl Rclient for Rserve [ Reply ]
By: luc moulinier on 2018-01-26 15:23
[forum:45593]
Thanks for your replay !
I do already tried svSocket and that works really well ! The main problem with it is that I can't make the socket server run in the background. I asked this question some months ago and people point me to Rserve.

In short, in a file "server.R":
library(svSocket)
startSocketServer(local=T, secure=F)
while (1) {}


and then :
Rscript server.R &

the script finishes and never stays in the process list although the infinite 'while' loop.


If you know a way to do so, then you've solved my problem !!! ;-)
Luc

RE: Tcl Rclient for Rserve [ Reply ]
By: Philippe Grosjean on 2018-01-26 14:37
[forum:45592]
Take a look at svSocket in CRAN, or at https://r-forge.r-project.org/projects/sciviews/. It implements a socket server in Tcl for R. This is NOT RServe, but since it is Tcl on the R side, it makes it perhaps easier to implement what you are looking for.

Best,

Philippe Grosjean

Tcl Rclient for Rserve [ Reply ]
By: luc moulinier on 2018-01-26 14:29
[forum:45591]
Hello !

IAs far as I know, there is no Tcl Rclient for Rserve, and I'd like to create one. It seems the Rserve protocol is quite complex.
I'm avaire there are clients for C++, Java or PHP. But (for example), the PHP client is not compatible with "Rsrv0103QAP1" server type. So I would prefer starting from scratch,. Furthermore, Tcl is not a typed langage which will make things easier for parsing Rserve answers.

Can someone point me to a detailed description of the Rserve communication protocol ?

Many thanks in advance !
Luc

Thanks to:
Vienna University of Economics and Business Powered By FusionForge