||This article may be confusing or unclear to readers. (January 2013)|
A datagram is a basic transfer unit associated with a packet-switched network in which the delivery, arrival time, and order of arrival are not guaranteed by the network service.
Origin of the term 
The term datagram appeared first within the project CYCLADES, a packet switching network created in the early 1970s, and was coined by Louis Pouzin by combining the words data and telegram. CYCLADES was the first network to make the hosts responsible for the reliable delivery of data, rather than the network itself, using unreliable datagrams and associated end-to-end protocol mechanisms.
“The inspiration for datagrams had two sources. One was Donald Davies' studies. He had done some simulation of datagram networks, although he had not built any, and it looked technically viable. The second inspiration was I like things simple. I didn't see any real technical motivation to overlay two levels of end-to-end protocols. I thought one was enough.”—Louis Pouzin
A datagram or packet needs to be self-contained without reliance on earlier exchanges because there is no connection of fixed duration between the two communicating points as there is, for example, in most voice telephone conversations.
RFC 1594 defines the term Datagram as follows:
“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.”
Datagram service is often compared to a mail delivery service, the user only provides the destination address, but receives no guarantee of delivery, and no confirmation upon successful delivery.
Datagram service routes datagrams without first creating a predetermined path. There is also no consideration given to the order in which it and other datagrams are sent or received. In fact, many datagrams in the same group can travel along different paths before reaching the same destination.
Structure of a datagram 
Each datagram has two components, a header and a data payload. The header contains all the information sufficient for routing from the originating equipment to the destination without relying on prior exchanges between the equipment and the network. Headers may include source and destination addresses as well as a type field. The payload is the data to be transported. This process of nesting data payloads in a tagged header is called encapsulation.
Use in the Internet Protocol 
The Internet Protocol defines standards for several types of datagrams.
Datagram service is a service provided by IP at the Internet layer. It is a connectionless, best effort, unreliable, message delivery service. Many higher level protocols including TCP (a connection-oriented service) depend on IP's Datagram service, laying additional functionality on top. UDP uses IP's Datagram service as well.
The term datagram is often considered synonymous to packet but there are some nuances. The term datagram is generally reserved for packets of an unreliable service that does not notify the user if delivery fails, while the term packet applies to any message formatted as a packet. For example, Internet Protocol (IP) provides an unreliable service and UDP over IP is also unreliable. That is why IP and UDP packets are generally called datagrams.
If a datagram fragments, then its fragments may be referred to as packets, but not as datagrams. TCP refers to its fragments as TCP segments, not packets, presumably to distinguish them from unreliable fragments.
See also 
- James Pelkey. "Entrepreneurial Capitalism and Innovation: A History of Computer Communications 1968-1988". Retrieved 2012-08-31.
- Andrew S. Tanenbaum, David J. Wetherall (2011, Fifth Edition. International Edition), "Computer Networks". ISBN 0-13-255317-1. ISBN 978-0-13-255317-9
- Kurose, James F. & Ross, Keith W. (2007), "Computer Networking: A Top-Down Approach" ISBN 0-321-49770-8
- RFC 760, 2.3. Function Description: "… to traverse a network whose maximum packet size is smaller than the size of the datagram."
- RFC 793