[Rd] Socks under R

Rainer M. Krug RKrug at sun.ac.za
Thu Oct 20 09:30:28 CEST 2005


That's brilliant!

Thanks a lot for your help,

Rainer

Simon Urbanek wrote:
> 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
> 



-- 
NEW TELEPHONE NUMBER
Tel:		+27 - (0)72 808 2975 (w)

Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
Biology (UCT)

Department of Conservation Ecology
University of Stellenbosch
Matieland 7602
South Africa

Tel:		+27 - (0)72 808 2975 (w)
Fax:		+27 - (0)21 808 3304
Cell:		+27 - (0)83 9479 042

email:	RKrug at sun.ac.za
       	Rainer at krugs.de



More information about the R-devel mailing list