mirror of
https://gitee.com/johng/gf.git
synced 2024-12-03 20:58:47 +08:00
17 lines
363 B
Go
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()
|
|
} |