Definition of datagram in The Network Encyclopedia.

What is Datagram (in computer networking)?

A term sometimes used as a synonym for «packet», but most often meaning a packet that is sent across a network using connectionless services, where the delivery doesn’t depend on the maintenance of specific connections between computers. Networking protocol suites such as TCP/IP generally support both connection-oriented and connectionless delivery services.

In TCP/IP, the Transmission Control Protocol (TCP) is responsible for providing connection-oriented services that guarantee delivery of Internet Protocol (IP) packets. In contrast, the User Datagram Protocol (UDP) handles connectionless services that guarantee only “best-effort” delivery of datagrams.

For networking services that use connectionless datagrams, higher-layer protocols must ensure delivery.

Datagrams are generally small packets sent over the network to perform functions such as announcements.

Difference between packets and datagrams

With connection-oriented protocol for communication, packets are used meaning that path is decided before any communication takes place.

TCP packet structure

There is a lot of information in the TCP packet provided for reliable communication. By reliable, it means when receiver receives a packet, error and flow checking is done.If all goes well then receiver sends acknowledgement with packet number to sender. The original sender, after receiving this ACK, only then will send the next packet. If any packet dropps out or any corrupted packet is received then receiver sends NACK with packet number and sender will re-transmit the same packet.

TCP packets are used by protocols that need to deliver the packet «intact», like FTP or Telnet.

On the other hand, Datagram don't realy care if something went wrong.

Datagram structure

There is no information like sequence number, ACK, FIN. Datagram doesn't decide path before transmitting as it's a connectionless protocol. His delivery is not assure.

It's typically used by media streaming, DHC servers, etc using UDP protocol. UDP protocol is an acronym that stands for User Datagram Protocol.

To better understand that difference you should read the TCP article and the UDP article.

For further reading, we recommend: The TCP/IP Guide: A Comprehensive, Illustrated Internet Protocols Reference.