public int ready() throws IOException {
if (descriptor.getChannel() instanceof SelectableChannel) {
int ready_stat = 0;
java.nio.channels.Selector sel = SelectorFactory.openWithRetryFrom(null, ((SelectableChannel) descriptor.getChannel()).provider());
SelectableChannel selchan = (SelectableChannel)descriptor.getChannel();
synchronized (selchan.blockingLock()) {
boolean is_block = selchan.isBlocking();
try {
selchan.configureBlocking(false);
selchan.register(sel, java.nio.channels.SelectionKey.OP_READ);
ready_stat = sel.selectNow();