Class TcpHandler

    • Constructor Detail

      • TcpHandler

        public TcpHandler​(int port,
                          Runnable readyRunnable)
        Constructor of TCPHandler that listens on selected port.
        Parameters:
        port - listening port of TCPHandler server
      • TcpHandler

        public TcpHandler​(InetAddress address,
                          int port,
                          Runnable readyRunnable)
        Constructor of TCPHandler that listens on selected address and port.
        Parameters:
        address - listening address of TCPHandler server
        port - listening port of TCPHandler server
    • Method Detail

      • run

        public void run()
        Starts server on selected port.
        Specified by:
        run in interface Runnable
      • getNumberOfConnections

        public int getNumberOfConnections()
        Returns the number of connected clients / channels.
        Returns:
        number of connected clients / channels
      • getPort

        public int getPort()
      • getAddress

        public String getAddress()
      • setChannelInitializer

        public void setChannelInitializer​(TcpChannelInitializer channelInitializer)
      • initiateEventLoopGroups

        public void initiateEventLoopGroups​(ThreadConfiguration threadConfiguration,
                                            boolean isEpollEnabled)
        Initiate event loop groups.
        Parameters:
        threadConfiguration - number of threads to be created, if not specified in threadConfig
      • initiateNioEventLoopGroups

        public void initiateNioEventLoopGroups​(ThreadConfiguration threadConfiguration)
        Initiate Nio event loop groups.
        Parameters:
        threadConfiguration - number of threads to be created, if not specified in threadConfig
      • initiateEpollEventLoopGroups

        protected void initiateEpollEventLoopGroups​(ThreadConfiguration threadConfiguration)
        Initiate Epoll event loop groups with Nio as fall back.
        Parameters:
        threadConfiguration - the ThreadConfiguration
      • getWorkerGroup

        public io.netty.channel.EventLoopGroup getWorkerGroup()