All Packages Class Hierarchy This Package Previous Next Index
Class java.net.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.
-
DatagramPacket(byte[], int)
- Constructs a
DatagramPacket for receiving packets of
length ilength.
-
DatagramPacket(byte[], int, InetAddress, int)
- Constructs a datagram packet for sending packets of length
ilength to the specified port number on the specified
host.
-
getAddress()
- Returns the IP address of the machine to which this datagram is being
sent or from which the datagram was received.
-
getData()
- Returns the data received or the data to be sent.
-
getLength()
- Returns the length of the data to be sent or the length of the
data received.
-
getPort()
- Returns the port number on the remote host to which this datagram is
being sent or from which the datagram was received.
-
setAddress(InetAddress)
-
-
setData(byte[])
-
-
setLength(int)
-
-
setPort(int)
-
DatagramPacket
method DatagramPacket(ibuf=byte[], -
ilength=int) public
- Constructs a
DatagramPacket for receiving packets of
length ilength.
The length argument must be less than or equal to
ibuf.length.
- Parameters:
- ibuf - buffer for holding the incoming datagram.
- ilength - the number of bytes to read.
DatagramPacket
method DatagramPacket(ibuf=byte[], -
ilength=int, -
iaddr=InetAddress, -
iport=int) public
- Constructs a datagram packet for sending packets of length
ilength to the specified port number on the specified
host. The length argument must be less than or equal
to ibuf.length.
- Parameters:
- ibuf - the packet data.
- ilength - the packet length.
- iaddr - the destination address.
- iport - the destination port number.
- See Also:
- InetAddress
getAddress
method getAddress() returns InetAddress public protect
- Returns the IP address of the machine to which this datagram is being
sent or from which the datagram was received.
- Returns:
- the IP address of the machine to which this datagram is being
sent or from which the datagram was received.
- See Also:
- InetAddress
getPort
method getPort() returns int public protect
- Returns the port number on the remote host to which this datagram is
being sent or from which the datagram was received.
- Returns:
- the port number on the remote host to which this datagram is
being sent or from which the datagram was received.
getData
method getData() returns byte[] public protect
- Returns the data received or the data to be sent.
- Returns:
- the data received or the data to be sent.
getLength
method getLength() returns int public protect
- Returns the length of the data to be sent or the length of the
data received.
- Returns:
- the length of the data to be sent or the length of the
data received.
setAddress
method setAddress(iaddr=InetAddress) public protect
setPort
method setPort(iport=int) public protect
setData
method setData(ibuf=byte[]) public protect
setLength
method setLength(ilength=int) public protect
All Packages Class Hierarchy This Package Previous Next Index