Skip to content
Prev 7547 / 12125 Next

[R-pkg-devel] socketConnection, delay when reading from

On 27/11/2021 4:09 a.m., Ben Engbers wrote:
You are attempting to read 1024 bytes.  If the socket returns fewer, the 
code presumably assumes it should wait for more.  You should specify the 
number to read to be no larger than you'll receive.  That's why reading 
a byte at a time works well for small reads.

To handle larger ones, you need to know what size blocks you are going 
to receive with each read.  If that varies unpredictably, I doubt if 
there's much you can do other than reducing the timeout.

Duncan Murdoch