Il giorno venerdì 6 maggio 2016 12:17:08 UTC+2, Rayland ha scritto:
I've built a simple client that sends multiple messages and server that
reads in a loop but that will only print the first message and then does

My purpose here is to send lots of messages on the same connection and I
am not interested in a response.
Also note that the code for reading a response, in server2.go, is not ideal.
You have:

     read_len, err := conn.Read(request)

but it should be, instead

     n, err := conn.Read(request)

That is, you should not use the entire buffer, but only the actual data
that has been read.
You should also avoid to allocate a new buffer for each Read.


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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 5 | next ›
Discussion Overview
groupgolang-nuts @
postedMay 6, '16 at 10:17a
activeMay 6, '16 at 6:48p

2 users in discussion

Rayland: 3 posts Manlio Perillo: 2 posts



site design / logo © 2021 Grokbase