Class NettyNetworkServer

    • Field Detail

      • channelFutures

        protected final java.util.Map<java.lang.Integer,​de.dytanic.cloudnet.common.collection.Pair<HostAndPort,​io.netty.channel.ChannelFuture>> channelFutures
      • packetDispatcher

        protected final java.util.concurrent.Executor packetDispatcher
      • bossEventLoopGroup

        protected final io.netty.channel.EventLoopGroup bossEventLoopGroup
      • workerEventLoopGroup

        protected final io.netty.channel.EventLoopGroup workerEventLoopGroup
      • networkChannelHandler

        protected final java.util.concurrent.Callable<INetworkChannelHandler> networkChannelHandler
    • Constructor Detail

      • NettyNetworkServer

        public NettyNetworkServer​(java.util.concurrent.Callable<INetworkChannelHandler> networkChannelHandler)
      • NettyNetworkServer

        @Deprecated
        public NettyNetworkServer​(java.util.concurrent.Callable<INetworkChannelHandler> networkChannelHandler,
                                  de.dytanic.cloudnet.common.concurrent.ITaskScheduler taskScheduler)
        Deprecated.
      • NettyNetworkServer

        @Deprecated
        public NettyNetworkServer​(java.util.concurrent.Callable<INetworkChannelHandler> networkChannelHandler,
                                  SSLConfiguration sslConfiguration,
                                  de.dytanic.cloudnet.common.concurrent.ITaskScheduler taskScheduler)
        Deprecated.
    • Method Detail

      • isSslEnabled

        public boolean isSslEnabled()
      • addListener

        public boolean addListener​(int port)
        Description copied from interface: INetworkServer
        Binds the server to a specific port with the host alias address "0.0.0.0"
        Specified by:
        addListener in interface INetworkServer
        Parameters:
        port - the port, that the server should bind
        Returns:
        true when the binding was successful or false if an error was threw or the port is already bind
      • addListener

        public boolean addListener​(@NotNull
                                   @NotNull HostAndPort hostAndPort)
        Description copied from interface: INetworkServer
        Binds the server to a specific address that is as parameter defined
        Specified by:
        addListener in interface INetworkServer
        Parameters:
        hostAndPort - the address that should the server bind
        Returns:
        true when the binding was successful or false if an error was threw or the port is already bind
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • getPacketDispatcher

        public java.util.concurrent.Executor getPacketDispatcher()
      • sendPacketSync

        public void sendPacketSync​(@NotNull
                                   @NotNull IPacket... packets)
        Description copied from interface: IPacketSender
        Transport packet instances into the network to the receiver synchronously. The receiver will handle the packets if he knows the channel and has listeners for the channel

        A packet are doesn't allow to be null All elements should be checked that be not null and send after that

        Specified by:
        sendPacketSync in interface IPacketSender
        Parameters:
        packets - the packets, which should transport into the network