Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #8941

Re: Channel Switch in GO, can I do this with java.nio

From Jan Burse <janburse@fastmail.fm>
Newsgroups comp.lang.java.programmer
Subject Re: Channel Switch in GO, can I do this with java.nio
Date 2011-10-18 09:16 +0200
Organization albasani.net
Message-ID <j7j950$bmk$1@news.albasani.net> (permalink)
References (1 earlier) <j7ho8o$32h$1@dont-email.me> <j7hrct$4f4$1@news.albasani.net> <j7i0jd$oj$1@dont-email.me> <8140673.542.1318892303608.JavaMail.geo-discussion-forums@prfk19> <j7imh9$d7q$1@dont-email.me>

Show all headers | View raw


markspace schrieb:
> I like this article. It's old, but since NIO was new when the article
> was written, it explains the basics without trying to do anything fancy.
> It seem pretty close to the information I have in my book.
>
> <https://www.ibm.com/developerworks/java/tutorials/j-nio/section9.html>
>
>

Thanks for the reference, very helpful.

P.S.:

Just out of habit I would code:

   if ((key.readyOps() & SelectionKey.OP_ACCEPT)
      == SelectionKey.OP_ACCEPT) {

      // Accept the new connection
      // ...
   }

With a different check:

   if ((key.readyOps() & SelectionKey.OP_ACCEPT)
      != 0) {

      // Accept the new connection
      // ...
   }

The same check is also used in the definition
of the method isAcceptable(), so it could be
also coded as:

   if (key.isAcceptable()) {

      // Accept the new connection
      // ...
   }

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Channel Switch in GO, can I do this with java.nio Jan Burse <janburse@fastmail.fm> - 2011-10-17 19:02 +0200
  Re: Channel Switch in GO, can I do this with java.nio markspace <-@.> - 2011-10-17 10:22 -0700
    Re: Channel Switch in GO, can I do this with java.nio Jan Burse <janburse@fastmail.fm> - 2011-10-17 20:15 +0200
      Re: Channel Switch in GO, can I do this with java.nio markspace <-@.> - 2011-10-17 12:44 -0700
        Re: Channel Switch in GO, can I do this with java.nio Lew <lewbloch@gmail.com> - 2011-10-17 15:58 -0700
          Re: Channel Switch in GO, can I do this with java.nio markspace <-@.> - 2011-10-17 18:59 -0700
            Re: Channel Switch in GO, can I do this with java.nio Jan Burse <janburse@fastmail.fm> - 2011-10-18 09:16 +0200
            Re: Channel Switch in GO, can I do this with java.nio Jan Burse <janburse@fastmail.fm> - 2011-10-18 09:20 +0200
              Re: Channel Switch in GO, can I do this with java.nio markspace <-@.> - 2011-10-18 07:49 -0700
                Re: Channel Switch in GO, can I do this with java.nio Jan Burse <janburse@fastmail.fm> - 2011-10-19 16:17 +0200

csiph-web