Class NioSocketChannel

    • Method Detail

      • isOpen

        public boolean isOpen()
        Description copied from interface: Channel
        Returns true if and only if this channel is open.
        Specified by:
        isOpen in interface Channel
        Overrides:
        isOpen in class AbstractChannel
      • isBound

        public boolean isBound()
        Description copied from interface: Channel
        Returns true if and only if this channel is bound to a local address.
        Specified by:
        isBound in interface Channel
      • isConnected

        public boolean isConnected()
        Description copied from interface: Channel
        Returns true if and only if this channel is connected to a remote address.
        Specified by:
        isConnected in interface Channel
      • setBound

        final void setBound()
      • setConnected

        final void setConnected()
      • setClosed

        protected boolean setClosed()
        Description copied from class: AbstractChannel
        Marks this channel as closed. This method is intended to be called by an internal component - please do not call it unless you know what you are doing.
        Overrides:
        setClosed in class AbstractNioChannel<java.nio.channels.SocketChannel>
        Returns:
        true if and only if this channel was not marked as closed yet
      • getLocalSocketAddress

        java.net.InetSocketAddress getLocalSocketAddress()
                                                  throws java.lang.Exception
        Specified by:
        getLocalSocketAddress in class AbstractNioChannel<java.nio.channels.SocketChannel>
        Throws:
        java.lang.Exception
      • getRemoteSocketAddress

        java.net.InetSocketAddress getRemoteSocketAddress()
                                                   throws java.lang.Exception
        Specified by:
        getRemoteSocketAddress in class AbstractNioChannel<java.nio.channels.SocketChannel>
        Throws:
        java.lang.Exception
      • write

        public ChannelFuture write​(java.lang.Object message,
                                   java.net.SocketAddress remoteAddress)
        Description copied from interface: Channel
        Sends a message to this channel asynchronously. It has an additional parameter that allows a user to specify where to send the specified message instead of this channel's current remote address. If this channel was created by a connectionless transport (e.g. DatagramChannel) and is not connected yet, you must specify non-null address. Otherwise, the write request will fail with NotYetConnectedException and an 'exceptionCaught' event will be triggered.
        Specified by:
        write in interface Channel
        Overrides:
        write in class AbstractChannel
        Parameters:
        message - the message to write
        remoteAddress - where to send the specified message. This method is identical to Channel.write(Object) if null is specified here.
        Returns:
        the ChannelFuture which will be notified when the write request succeeds or fails