public class PresentsConnection extends Connection
Message objects, sends messages to the
client and adds datagram support to a connection.| Modifier and Type | Class and Description |
|---|---|
static interface |
PresentsConnection.MessageHandler
|
selkey| Constructor and Description |
|---|
PresentsConnection() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearMessageHandler()
Clears out our message handler, causing any subsequent messages to be dropped on arrival.
|
InetSocketAddress |
getDatagramAddress()
Returns the address to which datagrams should be sent or null if no datagram address has
been established.
|
DatagramChannel |
getDatagramChannel()
Returns the channel through which datagrams should be sent or null if no datagram channel
has been established.
|
boolean |
getTransmitDatagrams()
Checks whether we should transmit datagrams.
|
void |
handleDatagram(InetSocketAddress source,
DatagramChannel channel,
ByteBuffer buf,
long when)
Processes a datagram sent to this connection.
|
int |
handleEvent(long when)
Called when a network event has occurred on this handler's source.
|
void |
init(ConnectionManager cmgr,
SocketChannel channel,
long createStamp)
Initializes the connection with its channel.
|
void |
postMessage(Message msg)
Posts a message for delivery to this connection.
|
void |
setClassLoader(ClassLoader loader)
Configures this connection with a custom class loader.
|
void |
setDatagramSecret(String secret)
Sets the secret string used to authenticate datagrams from the client.
|
void |
setMessageHandler(PresentsConnection.MessageHandler handler)
Instructs the connection to pass parsed messages on to this handler for processing.
|
void |
setTransmitDatagrams(boolean transmit)
Sets whether we should transmit datagrams.
|
asyncClose, becameIdle, checkIdle, close, connectFailure, getChannel, getConnectionId, getInetAddress, isClosed, networkFailure, toStringpublic void init(ConnectionManager cmgr, SocketChannel channel, long createStamp) throws IOException
PresentsConnectionManager as cmgr.init in class Connectioncmgr - The connection manager with which this connection is associated.channel - The socket channel from which we'll be reading messages.createStamp - The time at which this connection was created.IOExceptionpublic void setMessageHandler(PresentsConnection.MessageHandler handler)
public void clearMessageHandler()
public void setClassLoader(ClassLoader loader)
public void setTransmitDatagrams(boolean transmit)
public boolean getTransmitDatagrams()
public InetSocketAddress getDatagramAddress()
public DatagramChannel getDatagramChannel()
public void setDatagramSecret(String secret)
public void postMessage(Message msg)
public void handleDatagram(InetSocketAddress source, DatagramChannel channel, ByteBuffer buf, long when)
public int handleEvent(long when)
NetEventHandlerCopyright © 2015. All rights reserved.