In the context of UDP, a datagram is a basic transfer unit associated with a packet-switched network. Datagrams are independent, individual packets of data that are sent over the network. Each datagram contains information about the source and destination ports, the length of the datagram, and a checksum for error checking.