Environment: I am writing a UDP client-server application. the path MTU between client and server is 1500 bytes (with only a wireless link between them, so this value is pretty much stable). My system set don't fragment bit by default, and on both client and server, SO_SENDBUF is 16384, and SO_RECVBUF = 87380.
Question: Client use sendto to send 8192 bytes to server at once.I use Wireshark to see how these 8192 bytes will be sent in mow many packets, and discover that each packet only holds 1023 bytes of UDP data max. But given path MTU = 1500, shouldn't I be able to send 1500-20(IP header)-8(UDP header) = 1472 bytes of data in each packet? When I do the same thing with TCP, the result is what I expected. Each TCP packet can hold up to 1448 bytes, which is 1500-20(IP header)-32(TCP header with timestamp option) My question is: why dosn't UDP put 1472 bytes in each packet, instead of 1023 bytes? Is it just minor implementation detail? Or did I overlook some system restrictions?
Remark: The same result ca be observed even when I do the experiment on the same machine (with 127.0.0.1 on loopback interface).