rts-sim-testing-service/third_party/radar/radar_test.go
2024-01-29 18:05:14 +08:00

29 lines
506 B
Go

package radar
import (
"encoding/json"
"fmt"
"joylink.club/bj-rtsts-server/third_party/message"
"joylink.club/bj-rtsts-server/third_party/udp"
"testing"
)
func TestUdp(t *testing.T) {
fmt.Println("准备启动服务...")
addr := fmt.Sprintf("%v:%v", "127.0.0.1", "8899")
server := udp.NewServer(addr, handle)
server.Listen()
select {}
}
func handle(d []byte) {
ri := message.RadarInfo{}
err := ri.Decode(d)
if err == nil {
jsonD, _ := json.Marshal(ri)
fmt.Println(string(jsonD))
}
}