Module java.base
Package java.net

Class DatagramPacket

java.lang.Object
java.net.DatagramPacket

public final class DatagramPacket extends Object
This class represents a datagram packet.

Datagram packets are used to implement a connectionless packet delivery service. Each message is routed from one machine to another based solely on information contained within that packet. Multiple packets sent from one machine to another might be routed differently, and might arrive in any order. Packet delivery is not guaranteed.

Unless otherwise specified, passing a null argument causes a NullPointerException to be thrown.

Methods and constructors of DatagramPacket accept parameters of type SocketAddress. DatagramPacket supports InetSocketAddress, and may support additional SocketAddress sub-types.

Since:
1.0