I am learn about the ping command implementation. In that I had a one doubt. The doubt is

I know the socket buffer is for how many bytes transfer at a time in the socket. But how the ping command manages the socket buffer size.

$ ping -S 300 -s 400 google.com
PING google.com ( 400(428) bytes of data.
72 bytes from maa03s20-in-f14.1e100.net ( icmp_req=1 ttl=56 (truncated)
72 bytes from maa03s20-in-f14.1e100.net ( icmp_req=2 ttl=56 (truncated)
72 bytes from maa03s20-in-f14.1e100.net ( icmp_req=3 ttl=56 (truncated)
--- google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 40.231/41.500/42.408/0.924 ms

In the above ping command I was given the socket buffer size as 300 and the single packet size as 400. The socket buffer size is 300 only. But the the ping transfer the 400 bytes at a time in that socket. How it is possible. At the same time the received packet size is only 72. Why that is only 72.

Can any one please explain me.

1 Answer 1


These details are implementation specific. The packet size is exactly as you would expect. Using a smaller buffer size could in theory cause fragmentation of the packets but that doesn't happen on any system I've tried it on.

The result you obtain showing only 72 bytes received is because your VPS has severe restrictions which limit the packet size to 64 bytes + the 8 byte ICMP header.

You must log in to answer this question.