2
0
Fork 0

Initial implementation

master
Ambrose Chua 2018-10-10 12:17:58 +08:00
parent 1f7cc449f7
commit b9600ed72e
1 changed files with 29 additions and 0 deletions

29
main.go Normal file
View File

@ -0,0 +1,29 @@
package main
import (
"log"
"net"
"time"
)
const format = "Monday, January 2, 2006 15:04:05 MST"
func handle(conn net.Conn) {
t := time.Now()
conn.Write([]byte(t.Format(format)))
conn.Close()
}
func main() {
ln, err := net.Listen("tcp", ":13")
if err != nil {
panic(err)
}
for {
conn, err := ln.Accept()
if err != nil {
log.Print(err)
}
go handle(conn)
}
}