|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jcontrol.net.DatagramPacket
public class DatagramPacket
JControl Implementation of DatagramPacket. 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.
Constructor Summary | |
---|---|
DatagramPacket(byte[] buf,
int length,
InetAddress address,
int port)
Constructs a datagram packet for sending packets of length length to the specified port number on the specified host. |
Method Summary | |
---|---|
InetAddress |
getAddress()
Returns the IP address of the machine to which this datagram is being sent or from which the datagram was received. |
byte[] |
getData()
Returns the data buffer. |
int |
getLength()
Returns the length of the data to be sent or the length of the data received. |
int |
getOffset()
Returns the offset of the data to be sent or the offset of the data received. |
int |
getPort()
Returns the port number on the remote host to which this datagram is being sent or from which the datagram was received. |
void |
setAddress(InetAddress iaddr)
Sets the IP address of the machine to which this datagram is being sent. |
void |
setData(byte[] buf)
Set the data buffer for this packet. |
void |
setData(byte[] buf,
int offset,
int length)
Set the data buffer for this packet. |
void |
setLength(int length)
Set the length for this packet. |
void |
setPort(int port)
Sets the port number on the remote host to which this datagram is being sent. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, notifyAll, toString, wait |
Constructor Detail |
---|
public DatagramPacket(byte[] buf, int length, InetAddress address, int port)
buf
- - the packet data.length
- - the packet length.address
- - the destination address.port
- - the destination port number.Method Detail |
---|
public InetAddress getAddress()
public byte[] getData()
public int getLength()
public int getOffset()
public int getPort()
public void setAddress(InetAddress iaddr)
iaddr
- - the InetAddresspublic void setData(byte[] buf)
buf
- - the buffer to set for this packet
NullPointerException
- - if the argument is nullpublic void setData(byte[] buf, int offset, int length)
buf
- - the buffer to set for this packetoffset
- - the offset into the datalength
- - the length of the data and/or the length of the buffer used to receive data
NullPointerException
- - if the argument is nullpublic void setLength(int length)
length
- - the length to set for this packet.
IllegalArgumentException
- - if the length is negative or if the length is greater than the packet's data buffer length.public void setPort(int port)
port
- - the port number
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |