Re: [go-nuts] net.conn TCP connection

2019-12-31 Thread Ian Lance Taylor
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

Re: [go-nuts] net.conn TCP connection

2019-12-31 Thread jvmatl
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

Re: [go-nuts] net.conn TCP connection

2019-12-30 Thread Bakul Shah
> 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

Re: [go-nuts] net.conn TCP connection

2019-12-27 Thread Matthew Zimmerman
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

[go-nuts] net.conn TCP connection

2019-12-27 Thread ron . wahler
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