go-examples/echoserver/main.go
2017-07-09 15:15:38 +02:00

24 lines
256 B
Go

package main
import (
"io"
"net"
)
func main() {
ln, err := net.Listen("tcp", ":9000")
if err != nil {
panic(err)
}
defer ln.Close()
for {
conn, err := ln.Accept()
if err != nil {
panic(err)
}
io.Copy(conn, conn)
conn.Close()
}
}