Package marauroa.server.net.nio
Interface IWorker
- All Known Implementing Classes:
NIONetworkConnectionManager
public interface IWorker
This interface should be implemented by all the classes that are added as
workers to NIOServer
- Author:
- miguel
-
Method Summary
Modifier and TypeMethodDescriptionvoidonConnect(SocketChannel channel)This is a callback method that is called onConnect.voidonData(marauroa.server.net.nio.NioServer server, SocketChannel channel, byte[] data, int count)This method is called when data is received from a socket channel.voidonDisconnect(SocketChannel channel)This method is called when a connection to a client is closed.voidsetServer(marauroa.server.net.nio.NioServer server)This method associate this worker with a NIO Server.
-
Method Details
-
setServer
void setServer(marauroa.server.net.nio.NioServer server)This method associate this worker with a NIO Server.- Parameters:
server- NioServer
-
onConnect
This is a callback method that is called onConnect.- Parameters:
channel- SocketChannel
-
onData
void onData(marauroa.server.net.nio.NioServer server, SocketChannel channel, byte[] data, int count)This method is called when data is received from a socket channel.- Parameters:
server- NioServerchannel- SocketChanneldata- byte area containing the datacount- number of bytes used in the provided array
-
onDisconnect
This method is called when a connection to a client is closed.- Parameters:
channel- channel that was disconnected
-