public class Server extends java.lang.Object implements SelectHandler
Constructor and Description |
---|
Server(Config cfg,
java.lang.String host,
int port,
Progress loop,
ChannelHandler channelHandler,
boolean fixBuffers) |
Server(Config cfg,
java.lang.String host,
int port,
Progress loop,
ChannelHandler channelHandler,
boolean fixBuffers,
int backLog) |
Modifier and Type | Method and Description |
---|---|
void |
handleAccept(java.nio.channels.SelectableChannel ch)
Handle accept availability of channel
|
void |
handleConnect(java.nio.channels.SelectableChannel ch)
Handle a connection ready for channel
|
void |
handleError(java.nio.channels.SelectableChannel ch)
Handle error of channel
|
void |
handleRead(java.nio.channels.SelectableChannel ch)
Handle read availability of channel
|
void |
handleWrite(java.nio.channels.SelectableChannel ch)
Handle write availability of channel
|
boolean |
hasPending()
Stop the server while trying to process any queued responses
|
TCPMessage |
receive(java.nio.channels.SocketChannel sc,
java.nio.ByteBuffer buffer,
int size,
int edge) |
TCPMessage |
send(java.nio.channels.SocketChannel sc,
java.nio.ByteBuffer buffer,
int size,
int edge) |
boolean |
start()
Start listening on the port
|
void |
stop()
Stop the server
|
void |
stopGraceFully(long waitTime)
Stop the server while trying to process any queued responses
|
public Server(Config cfg, java.lang.String host, int port, Progress loop, ChannelHandler channelHandler, boolean fixBuffers)
public Server(Config cfg, java.lang.String host, int port, Progress loop, ChannelHandler channelHandler, boolean fixBuffers, int backLog)
public boolean start()
public void stop()
public boolean hasPending()
public void stopGraceFully(long waitTime)
public TCPMessage send(java.nio.channels.SocketChannel sc, java.nio.ByteBuffer buffer, int size, int edge)
public TCPMessage receive(java.nio.channels.SocketChannel sc, java.nio.ByteBuffer buffer, int size, int edge)
public void handleRead(java.nio.channels.SelectableChannel ch)
SelectHandler
handleRead
in interface SelectHandler
ch
- socket channelpublic void handleWrite(java.nio.channels.SelectableChannel ch)
SelectHandler
handleWrite
in interface SelectHandler
ch
- socket channelpublic void handleAccept(java.nio.channels.SelectableChannel ch)
SelectHandler
handleAccept
in interface SelectHandler
ch
- socket channelpublic void handleConnect(java.nio.channels.SelectableChannel ch)
SelectHandler
handleConnect
in interface SelectHandler
ch
- socket channelpublic void handleError(java.nio.channels.SelectableChannel ch)
SelectHandler
handleError
in interface SelectHandler
ch
- socket channel