Line 55 creates a new slice1 object every time you execute the body of the
loop. So it's always empty when you do the append(slice1, dataT). Try
moving it to line 37. I didn't closely examine your code but it looks like
there are other problems with it. For example, you don't use slice2 and the
logic for assigning to it looks wrong.

On Tue, Jan 14, 2020 at 7:03 PM nks <kabulo.n...@gmail.com> wrote:

> Hello Gophers,
>
> I created a TCP server that gets all the requests from the client and
> replies, however, when I try to append those requests in a slice, *the
> next request erases the previous one.*
>
> *The server should get requests and continuously save them in a slice for
> future manipulation.*
>
> *here is the code: https://play.golang.org/p/iooHSaoUFS4
> <https://play.golang.org/p/iooHSaoUFS4>*
>
>
> please help me to fix it...
>
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/9211b53e-d3b2-4fdb-81a3-84bb757a585f%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/9211b53e-d3b2-4fdb-81a3-84bb757a585f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD9SvHT%3DFZBBoFdA%3DTDLfrD6VMceGtmrxx5PKKfv-6WRBA%40mail.gmail.com.

Reply via email to