8

What would happen if my udp package is larger than mtu? Say my package is 512 bytes, after encapsulated, the package is 572 bytes. In transporting, some intermediate node fix it mtu size to 512 bytes, so what happens? Does my package simply being discarded?

In general, what is the best size of a udp package which fits for most of network situation?

1 Answers1

9

The package will still be sent, however the network interface layer (i.e. ethernet) will use multiple network transmissions to send it. You are still limited in size however by the maximum size for a UDP datagram (65535) as enforced by UDP/IP. See MTU and UDP Packets on Wikipedia for more info.

mshildt
  • 8,782
  • 3
  • 34
  • 41
  • 1
    So what do I recieved? One single package or fragmented packages? –  Jul 17 '17 at 12:43
  • You (at the software layer, in user space) receive a single datagram. Your network card receives the transmission in multiple fragments but this is transparent to you. – mshildt Jul 17 '17 at 12:44
  • So there's still a risk that some pieces of fragmented packages got lost, and the actual package I got is wrong, right? –  Jul 17 '17 at 12:46
  • 1
    No, if any of the fragments are lost, the entire UDP datagram is dropped. You either get the entire datagram or nothing. – mshildt Jul 17 '17 at 12:49
  • Thanks very much for answering. –  Jul 17 '17 at 12:50