From piotr2.chmielowski at citigroup.com  Mon Mar  5 18:05:43 2007
From: piotr2.chmielowski at citigroup.com (Chmielowski, Piotr2 [CAI])
Date: Mon, 5 Mar 2007 12:05:43 -0500
Subject: [Rd] non-blocking socketConnection
Message-ID: <617C6D86F3B78E44B37B5949CF1F8B0105942A4F@EXNJMB20.nam.nsroot.net>

In an R session I have

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

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
2.6.11-1.1369.

Any help would be greatly appreciated.



[Rd] non-blocking socketConnection
Chmielowski, Piotr2 [CAI]