On Tue, Dec 31, 2019 at 9:58 AM wrote:
>
> So I looked at the implementation of ReadAll, and found this interesting
> little nugget:
>
> if int64(int(capacity)) == capacity {
> 34 buf.Grow(int(capacity))
> 35 }
>
>
> To see it in context: https://golang.org/src/io/ioutil/ioutil.go?s=8
So I looked at the implementation of ReadAll, and found this interesting
little nugget:
if int64(int(capacity)) == capacity {34
buf.Grow(int(capacity))35 }
To see it in context:
https://golang.org/src/io/ioutil/ioutil.go?s=807:875#L18
Can anybody decipher what
> I am trying to understand what triggers the Csrc.Read(buf) to return
The Read call will eventually turn into a read() system call. For TCP it will
return as long as there is at least one byte in the kernel's receive buffer for
this connection, or if the buffer give to read() is filled up, or
https://golang.org/pkg/io/ioutil/#ReadAll
That might be what you want but if you don't know how big it's going to be,
you're also easily able to run out of memory.
On Fri, Dec 27, 2019, 7:11 PM wrote:
> I am looking for a net.conn standard read that would return a data buffer
> the exact size o
I am looking for a net.conn standard read that would return a data buffer
the exact size of the read. I am trying to read an unknown amount of byte
data from the connection. With the read i am using I am required to
pre-allocate a buffer and pass that buffer to the read. I am looking for a
read