Code example for SelectionKey

Methods: selector

0
            // it with the I/O selector for reading. 
            mChannel = channel;
            mChannel.configureBlocking(false);
            mSelectionKey = mChannel.register(mSelector, SelectionKey.OP_READ, this);
            // Start receiving read I/O. 
            mSelectionKey.selector().wakeup();
        } 
 
        /*********************************************************************** 
         * Abstract API implementation 
         **********************************************************************/ 
 
        /** 
         * Sends a message via this channel. 
         * 
         * @param msg Zero-terminated message string to send. 
         */ 
        @Override 
        public void sendMessage(String msg) throws IOException {
            if (msg.charAt(msg.length() - 1) != '\0') {
                Logw("Missing zero-terminator in message '" + msg + "'");