Example usage for Java java.net DatagramPacket fields, constructors, methods, implement or subclass
The text is from its open source code.
DatagramPacket(byte buf[], int length) Constructs a DatagramPacket for receiving packets of length length . | |
DatagramPacket(byte buf[], int offset, int length, SocketAddress address) Constructs a datagram packet for sending packets of length length with offset offset to the specified port number on the specified host. | |
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. | |
DatagramPacket(byte buf[], int offset, int length) Constructs a DatagramPacket for receiving packets of length length , specifying an offset into the buffer. | |
DatagramPacket(byte buf[], int length, SocketAddress address) Constructs a datagram packet for sending packets of length length to the specified port number on the specified host. | |
DatagramPacket(byte buf[], int offset, int length, InetAddress address, int port) Constructs a datagram packet for sending packets of length length with offset offset to the specified port number on the specified host. |
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. |
SocketAddress | getSocketAddress() Gets the SocketAddress (usually IP address + port number) of the remote host that this packet is being sent to or is coming from. |
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 iport) Sets the port number on the remote host to which this datagram is being sent. |
void | setSocketAddress(SocketAddress address) Sets the SocketAddress (usually IP address + port number) of the remote host to which this datagram is being sent. |