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.*
How to get the index of a slice of type string like in this example, I want
to test if the index equals to 3 in slice b and print ok.
a:=[int]string("hi","holla","salut") b=append(a) b =append(b,"c") for _,
count:= range b{ if b[]=3 { fmt.Println("ok") };
Enter code here...
--
You
e a request arrives.
> So a new empty map gets created each time a request arrives.
>
> The comment on the second line is wrong. The code does not "append" to the
> map. It overwrites the "client request" element.
>
>
> On Friday, 3 January 2020 07:14: