I write this code in the follwings: package main import ( "fmt" "net" "os" )
func main() { service := ":5000" tcpAddr, err := net.ResolveTCPAddr("tcp", service) checkError(err) listener, err := net.ListenTCP("tcp", tcpAddr) checkError(err) for i := 0; i < 10; i++ { conn, err := listener.Accept() if err != nil { continue } handleClient(conn) conn.Close() } } func handleClient(conn net.Conn) { var buf [512]byte for { n, err := conn.Read(buf[0:]) if err != nil { return } rAddr := conn.RemoteAddr() fmt.Println("receive from client", rAddr.String(), string(buf[0:n])) _, err2 := conn.Write([]byte("welcome client!")) if err2 != nil { return } } } func checkError(err error) { if err != nil { fmt.Fprintf(os.Stderr, "fatal error: %s", err.Error()) os.Exit(1) } } I try to run it in Sublime Text3 but it has no reaction and I try to run it in running windows, it shows: fatal error: lsiten tcp:5000:bind:Only one usage of each socket address(protocol/network address/port) is normally permitted.exit status 1 -- 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. For more options, visit https://groups.google.com/d/optout.