Size of empty UDP and TCP packet?

后端 未结 4 994
萌比男神i
萌比男神i 2020-11-29 02:37

What is the size of an empty UDP datagram? And that of an empty TCP packet?

I can only find info about the MTU, but I want to know what is the \"base\" size of these

4条回答
  •  无人及你
    2020-11-29 02:59

    Himanshus answer is perfectly correct.

    What might be misleading when looking at the structure of an Ethernet frame [see further reading], is that without payload the minimum size of an Ethernet frame would be 18 bytes: Dst Mac(6) + Src Mac(6) + Length (2) + Fcs(4), adding minimum size of IPv4 (20) and TCP (20) gives us a total of 58 bytes.

    What has not been mentioned yet is that the minimum payload of an ethernet frame is 46 byte, so the 20+20 byte from the IPv4 an TCP are not enough payload! This means that 6 bytes have to be padded, thats where the total of 64 bytes is coming from.

    18(min. Ethernet "header" fields) + 6(padding) + 20(IPv4) + 20(TCP) = 64 bytes

    Hope this clears things up a little.

    Further Reading:

    • Ethernet_frame
    • Ethernet

提交回复
热议问题