panic: dial tcp :8500: connectex: Only one usage of each socket address (protocol/network address/port) is normally permitted
这报错有人遇到过吗 求分析
更多评论
<a href="/user/wuly" title="@wuly">@wuly</a> func Run() {
for i := 1; i <= 19000; i++ {
conn, err := net.Dial("tcp", IP)
if err != nil {
fmt.Printf("Dial err,err = %v,Count = %v\n", err, i)
panic(err)
continue
}
robot := Robot{
conn: conn,
Coins: 1000000,
Uid: time.Now().UnixNano(),
}
robot.InitCoins()
go robot.ReceiveMsg() //接收
time.Sleep(time.Nanosecond)
fmt.Println("count: ",i)
}
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Kill)
<-c
}
#2