gf/geg/net/tcp_server.go
2018-01-09 10:14:24 +08:00

17 lines
363 B
Go

package main
import (
"net"
"gitee.com/johng/gf/g/net/gtcp"
)
func main() {
gtcp.NewServer(":8999", func(conn net.Conn) {
for {
buffer := make([]byte, 1024)
if length, err := conn.Read(buffer); err == nil {
conn.Write(append([]byte("> "), buffer[0 : length]...))
}
}
}).Run()
}