Commit 925657cd authored by szh's avatar szh

main add serial udp

parent 781da660
......@@ -12,6 +12,7 @@ import (
"chain33-pai/pkg/util"
"net"
"time"
"chain33-pai/service/pai_service"
)
func init() {
......@@ -85,16 +86,22 @@ func broadcast() {
}
conn, err := net.DialUDP("udp", &laddr, &raddr)
if err != nil {
println(err.Error())
log.Println(err.Error())
return
}
var pai pai_service.Pai
send := "hello world"
ok := pai.GetConfig()
if ok {
send = pai.Serial
}
for {
_, err := conn.Write([]byte("hello world"))
_, err := conn.Write([]byte(send))
if err != nil{
fmt.Println(err)
}
log.Println("send hello world")
log.Println(send)
time.Sleep(time.Second)
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment