java.net.DatagramPacket (JDK 1.0)
This class implements a "packet" of data that may be sent or received over the network through a DatagramSocket. One of the DatagramPacket constructors specifies an array of binary data to be sent with its destination address and port. A packet created with this constructor may then be sent with the send() method of a DatagramSocket. The other DatagramPacket constructor specifies an array of bytes into which data should be received. The receive() method of DatagramSocket waits for data and stores it in a DatagramPacket created in this way. The contents and sender of a received packet may be queried with the DatagramPacket instance methods.
public final classDatagramPacketextends Object { //Public ConstructorspublicDatagramPacket(byte[]ibuf, intilength); publicDatagramPacket(byte[]ibuf, intilength, InetAddressiaddr, intiport); //Public Instance Methodspublic synchronized InetAddressgetAddress(); public synchronized byte[]getData(); public synchronized intgetLength(); public synchronized intgetPort(); 1.1public synchronized voidsetAddress(InetAddressiaddr); 1.1public synchronized voidsetData(byte[]ibuf); 1.1public synchronized voidsetLength(intilength); 1.1public synchronized voidsetPort(intiport); }
Passed To:
DatagramSocket.receive(), DatagramSocket.send(), DatagramSocketImpl.receive(), DatagramSocketImpl.send(), MulticastSocket.send()