package main

import (
	"encoding/json"
	"log"
	"mfw/util"
	"net"
)

func main() {
	udpclient := util.UdpClient{Local: "127.0.0.1:1482", BufSize: 1024}
	udpclient.Listen(processUdpMsg2)
	m := map[string]string{
		"gtid":"5d19bf2fa5cb26b9b79b1994",
		"lteid":"5d19bf2fa5cb26b9b79b1995",
	}
	b, _ := json.Marshal(m)
	//for  range time.Tick(time.Second){
	err := udpclient.WriteUdp(b, util.OP_TYPE_DATA, &net.UDPAddr{
		IP:   net.ParseIP("172.17.145.163"),
		Port: 1481,
	})
	if err != nil{
		log.Println(err)
		return
	}
	log.Println("发送成功")
	//}
	select {

	}
}
func processUdpMsg2(act byte, data []byte, ra *net.UDPAddr) {
	log.Println(string(data))
}