Datagram Definations, Structure, Features and Packets
This article gives 3 different definations of datagram. We will also describe structure and features of datagram. Then we will compare datagram with packets. We will also have a comparison between datagrams and point to point dedicated channel communication.
Datagram Defination 1
A datagram is an independent, self-contained message sent over the network whose arrival, arrival time, and content are not guaranteed.
Datagram Defination 2
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 Defination 3: From Wikipedia
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.
Structure of a Datagram
Each datagram has two components, a header and a data payload.
Datagram Header: 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.
Datagram Data Payload: The payload is the data to be transported. This process of nesting data payloads in a tagged header is called encapsulation.
Features of Datagram Service
1. Datagram service is a service provided by IP at the Internet layer.
2. Datagram service is a connectionless, best effort, unreliable, message delivery service.
3. No Predetermined Path: Datagram service routes datagrams without first creating a predetermined path.
4. No Predetermined Order: There is 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.
5. A datagram supports only maximum of 65,535 bytes of data at a time.
Datagram vs Packet
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.
Datagram vs Dedicated Channel (Point to Point) Communication
Clients and servers that communicate via a perfect channel have a dedicated point-to-point channel between themselves. To communicate, they must first establish the connection, transmit the data, and then close down the connection. All data sent over the channel is received in the same order that it was sent. This is guaranteed by the channel.
In contrast, clients and servers that communicate via datagrams send and receive completely independent packets. These clients and servers do not have a dedicated point-to-point channel. Rather the packets are sent on their way over the network on whatever route is available.
A packet sent over a perfect channel does not contain any information about its source or its destination. The channel contains that information.
In contrast, a datagram packet must contain the complete address of its source or destination.