[Rd] non-blocking socketConnection

Chmielowski, Piotr2 [CAI] piotr2.chmielowski at citigroup.com
Mon Mar 5 18:05:43 CET 2007

In an R session I have

> c <-socketConnection("localhost", port=6011, blocking=F, server=T,

After I connect to the  server from, say, telnet 

% telnet localhost 6011

the socketConnection returns and gives a valid c. 

My problem is as follows : I would expect something like 

> readLines(con=c, n=1)

 to return immediately when reading from c non-blocking c, whether there
are any contents to be read or not. However, readLines only returns when
there is some input to be consumed, ie if in the telnet session I type
foo followed by newline. In short, readLines seems to be blocking even
though the connection is presumably non-blocking.

FYI, A "file" connection does behave as expected, but I do need the
socketConnection here. I am Running R 2.2.0-2.fc4, on Linux

Any help would be greatly appreciated.

More information about the R-devel mailing list