Previous | Next | Trail Map | Custom Networking and Security | Table of Contents


All About Datagrams (1.1notes)

Some applications that you write to communicate over the network will not require the reliable, point-to-point channel provided by TCP. Rather, your application might benefit from a mode of communication that delivered independent packages of information whose arrival and order of arrival were not guaranteed.

The UDP protocol provides a mode of network communication whereby applications send packets of data, called datagrams to one another. The DatagramPacket and DatagramSocket classes in the java.net package implement system-independent datagram communication using UDP.

What Is a Datagram?

A datagram is an independent, self-contained message sent over the network whose arrival, arrival time, and content are not guaranteed.

Writing a Datagram Client and Server

This section contains two Java programs that use datagrams to communicate. The server side is a quote server that listens to its DatagramSocket and sends a famous quotation to a a client whenever the client requests it. The client side is a simple program that simply makes one request of the server.


Previous | Next | Trail Map | Custom Networking and Security | Table of Contents