Class NettyNetworkChannel
- java.lang.Object
-
- de.dytanic.cloudnet.driver.network.DefaultNetworkChannel
-
- de.dytanic.cloudnet.driver.network.netty.NettyNetworkChannel
-
- All Implemented Interfaces:
INetworkChannel,IPacketSender,java.lang.AutoCloseable
@Internal public final class NettyNetworkChannel extends DefaultNetworkChannel implements INetworkChannel
-
-
Constructor Summary
Constructors Constructor Description NettyNetworkChannel(io.netty.channel.Channel channel, IPacketListenerRegistry packetRegistry, INetworkChannelHandler handler, HostAndPort serverAddress, HostAndPort clientAddress, boolean clientProvidedChannel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()io.netty.channel.ChannelgetChannel()booleanisActive()booleanisWriteable()voidsendPacket(@NotNull IPacket packet)Transport a packet instance into the network to the receiver.voidsendPacketSync(@NotNull IPacket packet)Transport packet instances into the network to the receiver synchronously.-
Methods inherited from class de.dytanic.cloudnet.driver.network.DefaultNetworkChannel
getChannelId, getClientAddress, getHandler, getPacketRegistry, getServerAddress, isClientProvidedChannel, registerQueryResponseHandler, sendChunkedPacketQuery, sendChunkedPackets, sendChunkedPackets, sendChunkedPacketsResponse, sendPacket, sendQuery, sendQueryAsync, setHandler
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.dytanic.cloudnet.driver.network.INetworkChannel
getChannelId, getClientAddress, getHandler, getPacketRegistry, getServerAddress, isClientProvidedChannel, registerQueryResponseHandler, sendChunkedPacketQuery, sendChunkedPackets, sendChunkedPackets, sendChunkedPacketsResponse, sendQuery, sendQueryAsync, setHandler
-
Methods inherited from interface de.dytanic.cloudnet.driver.network.protocol.IPacketSender
sendPacket, sendPacketSync
-
-
-
-
Constructor Detail
-
NettyNetworkChannel
public NettyNetworkChannel(io.netty.channel.Channel channel, IPacketListenerRegistry packetRegistry, INetworkChannelHandler handler, HostAndPort serverAddress, HostAndPort clientAddress, boolean clientProvidedChannel)
-
-
Method Detail
-
sendPacket
public void sendPacket(@NotNull @NotNull IPacket packet)Description copied from interface:IPacketSenderTransport a packet instance into the network to the receiver. The receiver will handle the packet if he knows the channel and has listeners for the channelThe packet are doesn't allow to be null
- Specified by:
sendPacketin interfaceIPacketSender- Parameters:
packet- the packet, which should transport into the network
-
sendPacketSync
public void sendPacketSync(@NotNull @NotNull IPacket packet)Description copied from interface:IPacketSenderTransport 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 channelA packet are doesn't allow to be null All elements should be checked that be not null and send after that
- Specified by:
sendPacketSyncin interfaceIPacketSender- Parameters:
packet- the packets, which should transport into the network
-
isWriteable
public boolean isWriteable()
- Specified by:
isWriteablein interfaceINetworkChannel
-
isActive
public boolean isActive()
- Specified by:
isActivein interfaceINetworkChannel
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
getChannel
public io.netty.channel.Channel getChannel()
-
-