Module java.base
Package java.net

Class DatagramPacket

java.lang.Object
java.net.DatagramPacket

public final classDatagramPacketextendsObject
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 anull argument causes aNullPointerException to be thrown.

Methods and constructors ofDatagramPacket accept parameters of typeSocketAddress.DatagramPacket supportsInetSocketAddress, and may support additionalSocketAddress sub-types.

Since:
1.0