Hi guys,
I’m trying to ping in parallel as much address as I can using go.
Right now I’m using a golang program to send ICMP packets, and another one to receive the ICMP packets.
I don’t have a problem send the packet, but the “receiver” keeps “pausing” when reading from the socket.
fd, _ := syscall.Socket(syscall.AF_INET, syscall.SOCK_RAW, syscall.IPPROTO_ICMP)
f := os.NewFile(uintptr(fd), fmt.Sprintf("fd %d", fd))
i := 0
for {
buf := make([]byte, 1024)
numRead, err := f.Read(buf)
if err != nil {
fmt.Println(err)
}
_ = numRead
//fmt.Printf("% X\n", buf[:numRead])
fmt.Println(i)
i++
}
This code can read about 250 pps, after that, it ignore most of the packets.
Thank you