gf/.example/net/gudp/gudp_server.go

18 lines
246 B
Go
Raw Normal View History

package main
import (
2019-04-03 00:03:46 +08:00
"fmt"
2019-07-29 21:01:19 +08:00
"github.com/gogf/gf/net/gudp"
)
func main() {
2019-04-03 00:03:46 +08:00
gudp.NewServer("127.0.0.1:8999", func(conn *gudp.Conn) {
defer conn.Close()
for {
data, err := conn.Recv(-1)
fmt.Println(err, string(data))
}
}).Run()
}