How can hping be so fast for sending packets?

I compared two tools for packet sending speed hpingand packETHcli. Command line options for packETHcli:

./packETHcli -i eth0 -m 2 -n 0 -d -1 -f icmpSample.pcap

and for hpp there

hping --flood 192.168.0.1

But in iptraf, it shows that the hping packet transfer rate is about 10 times faster than packETHcli.

Both tools use raw sockets, but why is there such a big difference?

Here is the link to get the source code.

hping: http://wiki.hping.org/

packETHcli: http://sourceforge.net/projects/packeth/

EDIT:  I noticed that it hpinguses the original AF_INET socket, the payload is TCP. packETHcliuse the source socket PF_PACKET, and in my example, the payload and IP packet with the ICMP payload. Does this affect packet transfer rates?

EDIT2

This time I use ifconfig to find the difference in TX packet counts between before and after starting hping3and packETHcli. And I found that the packet generation speeds are close for the two tools. hping3It is about 100,000 packets per second, and packETHcliabout 80,000 packets per second.

I also use vnstatto measure the speed of packet generation. And the result is consistent with the number I get from ifconfig.

, , iptraf . iptraf TCP- IP- TCP. iptraf , 0 . iptraf ?

+5
1

*.pcap. , toolETHcli *.pcap, , , *.pcap, , .

hping .

, .

, packETHcli, ?

0

All Articles