[R] blocking question with socketConnections

Andrew Young youngas7 at yahoo.com
Thu May 27 22:44:48 CEST 2004


I am writing a function to make a multi-part form
request with binary data.  I am running R 1.8.1 on
Linux ReadHat.

The sockectConnection is initialized with open="a+b"
and blocking=TRUE.

After writing the Post request using writeChar and
writeBin and flushing the connection I use
socketSelect to check if the socketConnection is
availabe for reading.  This call consistently takes 15
seconds or so (15.01 seconds; checked using
system.time).  After this the response is read using
readChar no problem.

However, when I perform the same operation using an
HTML form the whole operation takes approximately one
second.  I get the impression this has something to do
with blocking or something?  Is there a way to get
around blocking easily?  I tried initializing the
socketConnection with blocking=FALSE and creating a
loop that waits for selectSocket to return TRUE for
the connection in question, but this also takes about
15 seconds...

Why is this?  Is there anyway around this?

Any help is greatly appreciated.

-Andrew Young
youngas7 at yahoo.com
http://www.rho-project.org



	
		
__________________________________




More information about the R-help mailing list