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 Type
    Method
    Description
    void
    This is a callback method that is called onConnect.
    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.
    void
    This method is called when a connection to a client is closed.
    void
    setServer​(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

      void onConnect(SocketChannel channel)
      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 - NioServer
      channel - SocketChannel
      data - byte area containing the data
      count - number of bytes used in the provided array
    • onDisconnect

      void onDisconnect(SocketChannel channel)
      This method is called when a connection to a client is closed.
      Parameters:
      channel - channel that was disconnected