A datagram is a data transfer service that is associated with packet switching computer networks; the term was defined by A. Marine, J. Reynolds and G. Malkin in a Request for Comments document (shown below):
It is generally acknowleged that the term 'datagram' was not coined in relation to the Internet, or ARPANET, or any American computer network. The term was coined to describe how data was transported upon the CYCLADES packet switching network: the term being a combination of 'data' and 'telegram'. CYCLADES was a French packet switching network, launched in 1973, and pioneered a 'simple' network architecture where the host computers, instead of the network, was responsible for the delivery of data. CYCLADES invented end-to-end protocols, and it also inspired the creation of TCP/IP; TCP/IP is the core protocol suite of the Internet.
As the above Request for Comments document describes, a datagram can be likened to other data carrying services: like the postal service. In a postal service a person will mail a letter with a destination address printed on an envelope: likewise, within a datagram service, a datagram will be a data packet that has a header (envelope with routing information) and a payload (letter, data needing to be sent). In relation to the Internet, a datagram refers to a connectionless transfer of data: this means that the sender will format the packet header with a destination address, but will have no guarantee of the data (letter) being delivered.
The exact structure of a datagram will differ slightly depending on the protocol in question. In relation to Internet protocols, there are two primary protocols that provide a datagram service:
The Internet defines a datagram as a data delivery service (protocol) which is unreliable; therefore, TCP, which provides a reliable transfer of data is not considered a datagram service. A datagram is an unreliable data packet, sent by a 'best effort' transfer protocol.