public class Datagram
extends java.lang.Object
| Constructor and Description |
|---|
Datagram(DatagramSocket socket,
byte[] data,
int len)
Constructs a new datagram with the given address and data.
|
| Modifier and Type | Method and Description |
|---|---|
void |
closeSocket() |
byte[] |
getData()
Gets the contents of the data buffer.
|
long |
getIdentifier()
Returns the identifier for this datagram.
|
IPAddress |
getIPAddress()
Gets the address of the datagram.
|
java.lang.Object |
getJavaDatagram() |
int |
getLength()
Returns the length of this datagram.
|
int |
getPort()
Gets the port of the datagram.
|
IPAddress |
getSocketAddress()
Returns the address from which the datagram was send.
|
int |
getSocketPort()
Returns the port from which the datagram was send.
|
void |
release()
Returns this datagram into the pool of reusable datagram objects.
|
void |
send() |
void |
sendMonitored(Message message,
AttributedURI optionalMessageId,
ConnectionInfo connectionInfo) |
void |
setAddress(IPAddress address)
Sets the address of the datagram.
|
void |
setJavaDatagram(java.lang.Object javaDatagram) |
void |
setPort(int port)
Sets the port of the datagram.
|
void |
setSocket(DatagramSocket socket) |
java.lang.String |
toString() |
public Datagram(DatagramSocket socket, byte[] data, int len)
socket - the datagram socket from which this datagram was createddata - the data of the datagram.len - length of the real data.public void send()
throws java.io.IOException
java.io.IOExceptionpublic void sendMonitored(Message message, AttributedURI optionalMessageId, ConnectionInfo connectionInfo) throws java.io.IOException
java.io.IOExceptionpublic void setSocket(DatagramSocket socket)
public void closeSocket()
throws java.io.IOException
java.io.IOExceptionpublic void setAddress(IPAddress address)
address - the address of the datagram.public java.lang.Object getJavaDatagram()
public void setJavaDatagram(java.lang.Object javaDatagram)
public int getPort()
public void setPort(int port)
port - the port of the datagram.public IPAddress getIPAddress()
public IPAddress getSocketAddress()
NOTICE: this information is not always available (eg CLDC).
null if no address available.public int getSocketPort()
NOTICE: this information is not always available (eg CLDC).
null if no address available.public int getLength()
public byte[] getData()
public void release()
public long getIdentifier()
public java.lang.String toString()
toString in class java.lang.Object