Is there any standard that says that udp packets must not be combined together by operating system?

In other words can I be sure that when I send small udp packets by sendto or analogues, I will receive udp packets of the same size by recvfrom, if I request length, which is far more than the size any of the sent packets?

Ok, I am sure that receving side cannot concatenate datagrams, because they may come reordered or be missed. But what is about sending side? Say I make several sendto to the same address, why OS should not concatenate data?

1 Answer 1


It is not explicitly stated, but it is implied in the specification of the UDP protocol (RFC 768) that multiple packets that are sent independently are received independently.

UPD stands for User Datagram Protocol, and it is the Datagram that is relevant here.
A datagram is defined as

A self-contained, independent entity of data carrying sufficient information to be routed from the source to the destination computer without reliance on earlier exchanges between this source and destination computer and the transporting network.
-- RFC 1594

As datagrams are defined to be independent and self-contained, and because their delivery order (and if they arrive at all) is unspecified, there is no way by which an OS could stich multiple datagrams together in a meaningful way.

  • It is about receiving side. But what prevents an OS to concatenate data on the way between several sendto function calls and output on Ethernet? I understand that is unexpected behaviour, but what prevents? Dec 29, 2015 at 10:58
  • The very fact that it is unexpected makes it hard for the (intermediate) receiver to separate the datagrams again. The most likely case is that the packets get transmitted one after the other on Ethernet, but each with their own UDP/IP headers (and thus as separate datagrams). Dec 29, 2015 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.