mirror of
https://gitee.com/johng/gf.git
synced 2024-12-03 20:58:47 +08:00
17 lines
325 B
Go
17 lines
325 B
Go
package main
|
|
|
|
import (
|
|
"gitee.com/johng/gf/g/net/gudp"
|
|
"fmt"
|
|
)
|
|
|
|
func main() {
|
|
gudp.NewServer("127.0.0.1:8999", func(conn *gudp.Conn) {
|
|
defer conn.Close()
|
|
for {
|
|
if data, _ := conn.Recv(-1); len(data) > 0 {
|
|
fmt.Println(string(data))
|
|
}
|
|
}
|
|
}).Run()
|
|
} |