Hi,
I'm sleepy, so I'll try to cut the explanation to the bare minimum.
Definitions.
MTU - Maximum transmission unit - it's defined as the maximum payload size at L2.
IP datagram size - hopefully slightly less than the MTU.
UDP - datagram oriented protocol. Send a bunch of data through an UDP socket.
Case 1: data size < MTU - send as it is in one IP datagram.
Case 2: data size > MTU - send 2 or more datagrams (IP fragmentation, slightly inefficient).
TCP - stream oriented protocol. Send a bunch of data through a TCP socket.
Case whatever - TCP doesn't care if you send 1 byte or a LOT of bytes.
- Put the data in a buffer, when you have enough data to make a packet (or a timeout occurred), send them.
The "enough data" is the TCP segment size.
The optimum segment size is equal to the Path MTU payload. Any shorter datagram will only increase the network overhead (each segment has its own IP and TCP headers).
Problem: PMTU adaptation isn't yet implemented in ns-3 TCP.
Solution: use your head and do some offline math.
Cheers,
T.