message, err := bufio.NewReader(ServerConn).ReadString('\n')
if ( err != nil ){
fmt.Println("RELAY: ERROR: Reg Message read err:", err)
return
}
// had to preallocate a buffer, but I want a read to return me a buffer so I don't have to guess how big to make it.
buf := make([]byte, 1024*32)
// READ FROM CLIENT
nBytes, err := Csrc.Read(buf)
Is this not possible, I have not seen any examples that would indicate that there is a standard library that would do something like what I am looking for.
thanks,
Ron
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/96d2e64d-edce-4fb2-b4c2-970d04eedf14%40googlegroups.com.
On Dec 27, 2019, at 9:36 PM, Ron Wahler <ron.w...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/8ca83343-399d-47ef-aee0-0e173946c980%40googlegroups.com.
On Dec 27, 2019, at 9:48 PM, Robert Engels <ren...@ix.netcom.com> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/8F20C49C-7240-4E58-A25D-583BD0482115%40ix.netcom.com.
I did look at ReadAll, but it won't return until it sees EOF. I am trying to find something that would return when the standard read would return. I get the memory part and would manage that. Any other ideas ?
Csrc net.Conn
buf := make([]byte, 1024*32)
// READ FROM CLIENT
nBytes, err := Csrc.Read(buf)
Csrc.Read(buf) returns with a few bytes that I send to it. It does not wait for the entire allocated buf size to return. This works great, but I am looking for a way to not preallocate a large buffer.
I am prototyping with ReadAll, see the following snip it, but when I send a few bytes to this call with a client, it does not return. The documentation is saying it may be looking for an EOF which I do not send.
buf, read_err := ioutil.ReadAll(Csrc)
thanks,
Ron
On Dec 29, 2019, at 9:21 AM, Ron Wahler <ron.w...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/cd1f26d6-72aa-4239-83f2-18dc6220c2db%40googlegroups.com.
On Dec 30, 2019, at 11:04 AM, Jake Montgomery <jake...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/7e468329-2488-460c-9419-b4c55857b1eb%40googlegroups.com.
--
On Dec 30, 2019, at 12:04 PM, Bruno Albuquerque <b...@gmail.com> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAEd86TxqRRML-HDe7H8vESCTBOhBV3c%3DfY0gamEZrrb6XKgfzA%40mail.gmail.com.
I am trying to understand what triggers the Csrc.Read(buf) to return
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/cd1f26d6-72aa-4239-83f2-18dc6220c2db%40googlegroups.com.
On Dec 30, 2019, at 4:06 PM, Bruno Albuquerque <b...@gmail.com> wrote:
On Dec 30, 2019, at 4:17 PM, Robert Engels <ren...@ix.netcom.com> wrote:
On Dec 31, 2019, at 9:23 AM, Ron Wahler <ron.w...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/0e735f0e-dfb1-4e1f-9a2c-1b153be20514%40googlegroups.com.
On Dec 31, 2019, at 9:35 AM, Robert Engels <ren...@ix.netcom.com> wrote:
On Dec 31, 2019, at 10:03 AM, Ron Wahler <ron.w...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/24a6f6bd-8948-434c-bb83-c663d75bb23d%40googlegroups.com.
On Dec 31, 2019, at 10:37 AM, Robert Engels <ren...@ix.netcom.com> wrote:
if int64(int(capacity)) == capacity {
34 buf.Grow(int(capacity))
35 }
https://golang.org/pkg/io/ioutil/#ReadAllThat 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 <ron....@gmail.com> wrote:
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 that works more like the ReadString , but is for a byte slice.--// I want something similar to this read that returns the read string into the message string.message, err := bufio.NewReader(ServerConn).ReadString('\n')
if ( err != nil ){
fmt.Println("RELAY: ERROR: Reg Message read err:", err)
return
}
// had to preallocate a buffer, but I want a read to return me a buffer so I don't have to guess how big to make it.
buf := make([]byte, 1024*32)
// READ FROM CLIENT
nBytes, err := Csrc.Read(buf)
Is this not possible, I have not seen any examples that would indicate that there is a standard library that would do something like what I am looking for.
thanks,
Ron
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com.