title: Channels in Golang with TCP/IP socket not working
body: <p>I just started writting a Golang client for a server that I've made in C with TCP/IP sockets, then I figured out that my channel wasn't working.</p>
  
  <p>Any ideas why ?</p>
  
  <pre><code>func reader(r io.Reader, channel chan&lt;- []byte) {
    buf := make([]byte, 2048)
    for {
      n, err := r.Read(buf[:])
      if err != nil {
          return
      }
      channel &lt;- buf[0:n]
    }
  }
  func client(e *gowd.Element) {
   f, err := os.Create("/tmp/dat2")
   if err != nil {
      log.Fatal()
   }
   read := make(chan []byte)
   c, err := net.Dial("tcp", "127.0.0.1:4242")
   if err != nil {
      log.Fatal(err)
   }
   go reader(c, read)
   for {
      buf := &lt;-read
      n := strings.Index(string(buf), "\n")
      if n == -1 {
          continue
   }
   msg := string(buf[0:n])
   if msg == "WELCOME" {
      fmt.Fprint(c, "GRAPHIC\n")
   }
   f.WriteString(msg + "\n")
  }
  </code></pre>
  
  <p>Testing my server with netcat results in the following output : 
  <a href="http://pasted.co/a37b2954" rel="nofollow noreferrer">http://pasted.co/a37b2954</a></p>
  
  <p>But i only have : <a href="http://pasted.co/f13d56b4" rel="nofollow noreferrer">http://pasted.co/f13d56b4</a></p>
  
  <p>I'm new to chan in Golang so maybe I'm wrong (I probably am)</p>