title: How to create client server in Go language?
body: <p>I am new to go,
  I was trying to prepare client server in go language and tried to write code, but it's not giving any output. It's not giving any error but just listening.</p>
  
  <p>Please someone help me, I want to create authentication system using go where server authenticate client using Username password..</p>
  
  <p><strong>server :</strong></p>
  
  <pre><code>package main
  
  import (
          "fmt"
          "net"
  )
  
  func main() {
          service := "0.0.0.0:8080"
          tcpAddr, err := net.ResolveTCPAddr("tcp", service)
          checkError(err)
          listener, err := net.ListenTCP("tcp", tcpAddr)
          checkError(err)
          for {
                  conn, err := listener.Accept()
                  //fmt.Println("Server listerning")
                  _, err = conn.Read([]byte("HEAD"))
                  if err != nil {
                          conn.Close()
                  }
                  if err != nil {
                          continue
                  }
          }
  }
  
  func checkError(err error) {
          if err != nil {
                  fmt.Println("Fatal error ", err.Error())
          }
  }
  </code></pre>
  
  <p><strong>client :</strong></p>
  
  <pre><code>package main
  
  import (
          "bufio"
          "fmt"
          "net"
          "os"
          "strings"
  )
  
  func main() {
          if len(os.Args) != 2 {
                  fmt.Println("Usage: ", os.Args[0], "host")
                  os.Exit(1)
          }
          host := os.Args[1]
          conn, err := net.Dial("tcp", host+":8080")
          checkError(err)
          _, err = conn.Write([]byte("HEAD"))
          reader := bufio.NewReader(os.Stdin)
          for {
                  line, err := reader.ReadString('\n')
                  ftm.Println(err)
                  line = strings.TrimRight(line, " \t\r\n")
                  if err != nil {
                          conn.Close()
                          break
  
                  }
          }
  }
  func checkError(err error) {
          if err != nil {
                  fmt.Println("Fatal error ", err.Error())
          }
  }
  </code></pre>