Skip to content
Prev 180571 / 398503 Next

newbie: closing unused connection + readline

On Sat, May 16, 2009 at 6:12 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
Thank you Sir but is there a way that it does not get open each time?
I mean following line creates a new text connection each time so how
to avoid it or reuse an open connection?

line.raw <- textConnection(readLines( reader.socket, n = 1, ok = TRUE));

I tried something line this also:

mydataframe <- read.table (socket, sep=",");

but does not work says no input lines.

this also.

mydataframe <- read.table (readLine(socket), sep=",");

what is the best method of doing something like this? I am getting
totally lost between textConnection, socket and getConnection.  Now I
am trying to get the connection that was opened and reuse it but then
how do I get connection that was previously opened when running code -
since getConnection() requires a number and for that I need to know
the number of my previously opened connection. So how do I get the
number of textConnection that I open?

Sir any pointers would greatly help.

Thanks and regards
-Aval