read ip4 10.0.20.12->103.97.129.254: i/o timeout

master
dustoair 3 years ago
parent 105ebd8927
commit 0dac3c9fa2

@ -119,23 +119,32 @@ func Ping(domain string, PS int) {
yellow := color.New(color.FgYellow).SprintFunc()
for {
/*
++
++
errornil
*/
index, err := conn.Write(buffer.Bytes())
if err != nil {
//这种判断其实不必要 发包一定可以 error返回一定是nil
fmt.Printf("%s\n", red("timeout", index))
dropPack++
time.Sleep(time.Second)
continue
}
//index, err := conn.Write(buffer.Bytes())
//if err != nil {
// //这种判断其实不必要 发包一定可以 error返回一定是nil
// fmt.Printf("%s\n", red("timeout", index))
// dropPack++
// time.Sleep(time.Second)
// continue
//}
// 否则记录当前得时间
t_start := time.Now()
conn.SetReadDeadline((time.Now().Add(time.Second * 3)))
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