On Mar 5, 2007, at 12:05 PM, Chmielowski, Piotr2 [CAI] wrote:
> 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.
>
if (socketSelect(list(c),,0)) readLines(c, 1)
Cheers,
Simon