activemq-cpp-3.6.0
|
Class that represents a single datagram packet. More...
#include <src/main/decaf/net/DatagramPacket.h>
Public Member Functions | |
DatagramPacket (unsigned char *bytes, int size, int length) | |
Creates a new DatagramPacket for use in receiving a packet of the given length. | |
DatagramPacket (unsigned char *bytes, int size, int offset, int length) | |
Creates a new DatagramPacket for use in receiving a packet of the given length starting at the specified offset into the buffer. | |
DatagramPacket (unsigned char *bytes, int size, int offset, int length, const InetAddress &address, int port) | |
Creates a new DatagramPacket for use in sending a packet of the given length starting at the specified offset into the buffer to the specified host on the specified port. | |
DatagramPacket (unsigned char *bytes, int size, int length, const InetAddress &address, int port) | |
Creates a new DatagramPacket for use in sending a packet of the given length to the specified host on the specified port. | |
DatagramPacket (unsigned char *bytes, int size, int length, const SocketAddress &address) | |
Creates a new DatagramPacket for use in sending a packet of the given length into the buffer to the specified socket address. | |
DatagramPacket (unsigned char *bytes, int size, int offset, int length, const SocketAddress &address) | |
Creates a new DatagramPacket for use in sending a packet of the given length starting at the specified offset into the buffer to the specified socket address. | |
virtual | ~DatagramPacket () |
InetAddress * | getAddress () const |
void | setAddress (const InetAddress &address) |
Sets the IP address of the machine to which this datagram is being sent. | |
SocketAddress * | getSocketAddress () const |
Gets the SocketAddress (usually IP address + port number) of the remote host that this packet is being sent to or is coming from. | |
void | setSocketAddress (const SocketAddress &address) |
Sets the SocketAddress (usually IP address + port number) of the remote host to which this datagram is being sent. | |
int | getPort () const |
void | setPort (int port) |
Sets the port number on the remote host to which this datagram is being sent. | |
int | getOffset () const |
void | setOffset (int offset) |
Sets the offset into the data buffer where data to sent is to be read from or where the data that is received should start writing to. | |
int | getLength () const |
void | setLength (int length) |
Set the length for this packet. | |
unsigned char * | getData () const |
int | getSize () const |
void | setData (unsigned char *buffer, int size) |
Set the data buffer for this packet. | |
void | setData (unsigned char *buffer, int size, int offset, int length) |
Set the data buffer for this packet. |
Class that represents a single datagram packet.
Datagrams are sent in packets from machine to machine and can each be routed differently and can arrive in any order. Delivery of a packet is not guaranteed.
decaf::net::DatagramPacket::DatagramPacket | ( | unsigned char * | bytes, |
int | size, | ||
int | length | ||
) |
Creates a new DatagramPacket for use in receiving a packet of the given length.
bytes | The array of bytes to hold the incoming datagram buffer. |
size | The size of the supplied byte array. |
length | The number of byte to read starting at the supplied offset. |
NullPointerException | if the pointer to the buffer is NULL. |
IndexOutOfBoundsException | if the number of bytes to read exceeds the buffer size. |
decaf::net::DatagramPacket::DatagramPacket | ( | unsigned char * | bytes, |
int | size, | ||
int | offset, | ||
int | length | ||
) |
Creates a new DatagramPacket for use in receiving a packet of the given length starting at the specified offset into the buffer.
bytes | The array of bytes to hold the incoming datagram buffer. |
size | The size of the supplied byte array. |
offset | The position in the array to start writing to. |
length | The number of byte to read starting at the supplied offset. |
NullPointerException | if the pointer to the buffer is NULL. |
IndexOutOfBoundsException | if the number of bytes to copy exceeds the buffer size. |
decaf::net::DatagramPacket::DatagramPacket | ( | unsigned char * | bytes, |
int | size, | ||
int | offset, | ||
int | length, | ||
const InetAddress & | address, | ||
int | port | ||
) |
Creates a new DatagramPacket for use in sending a packet of the given length starting at the specified offset into the buffer to the specified host on the specified port.
bytes | The array of bytes to hold the outgoing datagram buffer. |
size | The size of the supplied byte array. |
offset | The position in the array to start writing to. |
length | The number of byte to read starting at the supplied offset. |
address | The Address to send the packet to |
port | The port on the destination that is to receive this packet. |
NullPointerException | if the pointer to the buffer is NULL. |
IndexOutOfBoundsException | if the number of bytes to copy exceeds the buffer size. |
decaf::net::DatagramPacket::DatagramPacket | ( | unsigned char * | bytes, |
int | size, | ||
int | length, | ||
const InetAddress & | address, | ||
int | port | ||
) |
Creates a new DatagramPacket for use in sending a packet of the given length to the specified host on the specified port.
bytes | The array of bytes to hold the outgoing datagram buffer. |
size | The size of the supplied byte array. |
length | The number of byte to read starting at the supplied offset. |
address | The Address to send the packet to |
port | The port on the destination that is to receive this packet. |
NullPointerException | if the pointer to the buffer is NULL. |
IndexOutOfBoundsException | if the number of bytes to copy exceeds the buffer size. |
decaf::net::DatagramPacket::DatagramPacket | ( | unsigned char * | bytes, |
int | size, | ||
int | length, | ||
const SocketAddress & | address | ||
) |
Creates a new DatagramPacket for use in sending a packet of the given length into the buffer to the specified socket address.
bytes | The array of bytes to hold the outgoing datagram buffer. |
size | The size of the supplied byte array. |
length | The number of byte to read starting at the supplied offset. |
address | The Address to send the packet to |
NullPointerException | if the pointer to the buffer is NULL. |
IndexOutOfBoundsException | if the number of bytes to copy exceeds the buffer size. |
decaf::net::DatagramPacket::DatagramPacket | ( | unsigned char * | bytes, |
int | size, | ||
int | offset, | ||
int | length, | ||
const SocketAddress & | address | ||
) |
Creates a new DatagramPacket for use in sending a packet of the given length starting at the specified offset into the buffer to the specified socket address.
bytes | The array of bytes to hold the outgoing datagram buffer. |
size | The size of the supplied byte array. |
offset | The position in the array to start writing to. |
length | The number of byte to read starting at the supplied offset. |
address | The Address to send the packet to |
NullPointerException | if the pointer to the buffer is NULL. |
IndexOutOfBoundsException | if the number of bytes to copy exceeds the buffer size. |
|
virtual |
InetAddress* decaf::net::DatagramPacket::getAddress | ( | ) | const |
unsigned char* decaf::net::DatagramPacket::getData | ( | ) | const |
int decaf::net::DatagramPacket::getLength | ( | ) | const |
int decaf::net::DatagramPacket::getOffset | ( | ) | const |
int decaf::net::DatagramPacket::getPort | ( | ) | const |
int decaf::net::DatagramPacket::getSize | ( | ) | const |
SocketAddress* decaf::net::DatagramPacket::getSocketAddress | ( | ) | const |
Gets the SocketAddress (usually IP address + port number) of the remote host that this packet is being sent to or is coming from.
void decaf::net::DatagramPacket::setAddress | ( | const InetAddress & | address | ) |
Sets the IP address of the machine to which this datagram is being sent.
address | The IP address. |
void decaf::net::DatagramPacket::setData | ( | unsigned char * | buffer, |
int | size | ||
) |
Set the data buffer for this packet.
With the offset of this DatagramPacket set to 0, and the length set to the size value specified.
buffer | The new data buffer to use for this datagram packet. |
size | The size of the buffer. |
NullPointerException | if the buffer pointer is NULL. |
void decaf::net::DatagramPacket::setData | ( | unsigned char * | buffer, |
int | size, | ||
int | offset, | ||
int | length | ||
) |
Set the data buffer for this packet.
With the offset of this DatagramPacket set to 0, and the length set to the size value specified.
buffer | The new data buffer to use for this datagram packet. |
size | The size of the buffer. |
offset | The position in the buffer to read from or write to. |
length | The number of bytes that will be read into the buffer or sent from the buffer. |
NullPointerException | if the buffer pointer is NULL. |
void decaf::net::DatagramPacket::setLength | ( | int | length | ) |
Set the length for this packet.
The length of the packet is the number of bytes from the packet's data buffer that will be sent, or the number of bytes of the packet's data buffer that will be used for receiving data. The length must be lesser or equal to the offset plus the length of the packet's buffer.
length | The length value to set for this packet. |
IllegalArgumentException | if the value is negative or exceeds the data buffers length. |
void decaf::net::DatagramPacket::setOffset | ( | int | offset | ) |
Sets the offset into the data buffer where data to sent is to be read from or where the data that is received should start writing to.
offset | The buffer offset value. |
IllegalArgumentException | if the offset value is greater than the buffer size. |
void decaf::net::DatagramPacket::setPort | ( | int | port | ) |
Sets the port number on the remote host to which this datagram is being sent.
port | The port on the remote host. |
IllegalArgumentException | if the port value is not in the range [0..65535]. |
void decaf::net::DatagramPacket::setSocketAddress | ( | const SocketAddress & | address | ) |
Sets the SocketAddress (usually IP address + port number) of the remote host to which this datagram is being sent.
address | The SocketAddress (IP + port) for this datagram packet. |
IllegalArgumentException | if the subclass of address is not supported by this Socket. |