I write a echo server as below: package main
import ( "io" "log" "net" ) func main() { l, err := net.Listen("tcp", ":2000") checkErr(err) defer l.Close() for { conn, err := l.Accept() if err != nil { log.Fatal(err) continue } go func(c net.Conn) { io.Copy(c, c) c.Close() }(conn) } } func checkErr(err error) { if err != nil { panic(err) } } Then I use telnet to test: ➜ telnet localhost 2000 Trying ::1... Connected to localhost. Escape character is '^]'. abc abc def def I don't understand why the connection at clinet side is not closed after `c.Close()` ? -- 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.