[Rd] Socks under R
Simon Urbanek
simon.urbanek at r-project.org
Thu Oct 20 00:05:42 CEST 2005
Rainer,
On Oct 19, 2005, at 3:29 PM, Rainer M. Krug wrote:
> when I use
>
> con1 <- socketConnection(...)
>
> in R and want to send text from another application written in
> Delphi to R, do I just have to send the text or do I have to
> implement more control characters and so on?
Sockets are just reliable bi-directional communication channels (in
the default mode), so their use is entirely up to you (both on R side
and other application's side).
> Is
>
> con1 <- socketConnection(port=6011, server=TRUE)
> writeLines("plot(rnorm(100))", con1)
>
> just sending the text in "plot(rnorm(100))" to the socket or is it
> doing more (R specific protocoll for socks comminication)?
It basically equivalent to using "send" on the socket API level [i.e.
the above effectively does send(s, "plot(rnorm(100))\n", 17, 0)], so
it's up to the other side to receive it properly. There is no "R
specific protocol" - socket connections in R use regular TCP (neither
red nor white "socks" ;)), so the literature on socket programming is
your friend (e.g. using readLines(con1) for incoming traffic in your
example would be a bad idea).
Cheers,
Simon
More information about the R-devel
mailing list