UDP Packet size and packet losses

前端 未结 3 513
孤城傲影
孤城傲影 2021-01-05 17:22

I\'ve been writing a program that uses a stop and wait protocol on top of UDP to send packets over LAN and also over WAN. I\'ve recently been testing my program and have not

3条回答
  •  礼貌的吻别
    2021-01-05 18:00

    UDP packets greater than the MTU size of the network that carries them will be automatically split up into multiple packets, and then reassembled by the recipient. If any of those multiple sub-packets gets dropped, then the receiver will drop the rest of them as well.

    So for example if you send a 63k UDP packet, and it goes over Ethernet, it will get broken up into 47+ smaller "fragment" packets (because Ethernet's MTU is 1500 bytes, but some of those are used for UDP headers, etc, so the amount of user-data-space available in a UDP packet is smaller than that). The receiver will only "see" that UDP packet if all 47+ of those fragment-packets make it through okay. If just one of those fragment-packets gets dropped, the whole operation fails.

提交回复
热议问题