read ip4 10.0.20.12->103.97.129.254: i/o timeout

master
dustoair 3 years ago
parent 105ebd8927
commit 0dac3c9fa2

@ -121,21 +121,30 @@ func Ping(domain string, PS int) {
/* /*
++ ++
errornil
*/ */
index, err := conn.Write(buffer.Bytes()) //index, err := conn.Write(buffer.Bytes())
if err != nil { //if err != nil {
//这种判断其实不必要 发包一定可以 error返回一定是nil // //这种判断其实不必要 发包一定可以 error返回一定是nil
fmt.Printf("%s\n", red("timeout", index)) // fmt.Printf("%s\n", red("timeout", index))
dropPack++ // dropPack++
time.Sleep(time.Second) // time.Sleep(time.Second)
continue // continue
} //}
// 否则记录当前得时间 // 否则记录当前得时间
t_start := time.Now() t_start := time.Now()
conn.SetReadDeadline((time.Now().Add(time.Second * 3))) conn.SetReadDeadline((time.Now().Add(time.Second * 3)))
len, err := conn.Read(recv) len, err := conn.Read(recv)
fmt.Println(len, err) //strings.Contains(err.Error(), "timeout")
//超时状态 len=0 error包含 read ip4 10.0.20.12->103.97.129.254: i/o timeout
if len == 0 && err != nil {
fmt.Printf("%s\n", red("timeout"))
dropPack++
time.Sleep(time.Second)
continue
}
/* /*
++ ++

Loading…
Cancel
Save