添加车库门模型和ecs组件、实体、系统
This commit is contained in:
parent
11ce706969
commit
83a725e703
@ -24,24 +24,24 @@ var ti = &ReceiveTrainInfo{
|
|||||||
var trainRun bool
|
var trainRun bool
|
||||||
|
|
||||||
// var IP = net.IPv4(192, 168, 3, 7)
|
// var IP = net.IPv4(192, 168, 3, 7)
|
||||||
// var SendIP = net.IPv4(192, 168, 3, 7)
|
// var SendIpPort = net.IPv4(192, 168, 3, 7)
|
||||||
var IP = net.IPv4(127, 0, 0, 1)
|
var IP = net.IPv4(127, 0, 0, 1)
|
||||||
var SendIP = "127.0.0.1"
|
var SendIpPort = "127.0.0.1:10000"
|
||||||
var tick = 10 * time.Millisecond
|
var tick = 10 * time.Millisecond
|
||||||
|
|
||||||
// 参数1:ip 参数2:间隔
|
// 参数1:ip 参数2:间隔
|
||||||
func main() {
|
func main() {
|
||||||
if len(os.Args) >= 2 && os.Args[1] != "" {
|
if len(os.Args) >= 2 && os.Args[1] != "" {
|
||||||
SendIP = os.Args[0]
|
SendIpPort = os.Args[1]
|
||||||
}
|
}
|
||||||
if len(os.Args) >= 3 && os.Args[2] != "" {
|
if len(os.Args) >= 3 && os.Args[2] != "" {
|
||||||
i, err := strconv.Atoi(os.Args[1])
|
i, err := strconv.Atoi(os.Args[2])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
tick = time.Duration(i) * time.Millisecond
|
tick = time.Duration(i) * time.Millisecond
|
||||||
}
|
}
|
||||||
fmt.Println("目的IP:", SendIP)
|
fmt.Println("目的IP_Port:", SendIpPort)
|
||||||
fmt.Println("间隔:", tick, "毫秒")
|
fmt.Println("间隔:", tick, "毫秒")
|
||||||
listen, err := net.ListenUDP("udp", &net.UDPAddr{
|
listen, err := net.ListenUDP("udp", &net.UDPAddr{
|
||||||
IP: IP,
|
IP: IP,
|
||||||
@ -53,12 +53,12 @@ func main() {
|
|||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
tick := time.Tick(tick)
|
tick := time.Tick(tick)
|
||||||
remoteAddr, err := net.Dial("udp", fmt.Sprintf("%s:%d", SendIP, 10000))
|
remoteAddr, err := net.Dial("udp", SendIpPort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Dial udp err: %v", err)
|
fmt.Printf("Dial udp err: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//remoteAddr := &net.UDPAddr{IP: SendIP, Port: 10000}
|
//remoteAddr := &net.UDPAddr{IP: SendIpPort, Port: 10000}
|
||||||
// 循环推送信息
|
// 循环推送信息
|
||||||
for {
|
for {
|
||||||
<-tick
|
<-tick
|
||||||
|
Loading…
Reference in New Issue
Block a user