24 lines
309 B
Go
24 lines
309 B
Go
|
package main
|
||
|
|
||
|
import "fmt"
|
||
|
import "io"
|
||
|
import "net"
|
||
|
import "time"
|
||
|
|
||
|
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.WriteString(conn, fmt.Sprint(time.Now()))
|
||
|
conn.Close()
|
||
|
}
|
||
|
}
|