Bad throughput reiciveing ICMP packets

(vincent) #1

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 {
	_ = numRead
	//fmt.Printf("% X\n", buf[:numRead])

This code can read about 250 pps, after that, it ignore most of the packets.
Thank you

(system) closed #2

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.