users@glassfish.java.net

Java NIO question

From: <glassfish_at_javadesktop.org>
Date: Fri, 05 Sep 2008 21:33:36 PDT

Hi all,

Not sure if this is the right place to post this message. I am new to Java NIO (socket development to be exact) and read through Grizzly. I always try to understand the underlying before picking a framework to use.

I am wonder if concurent read/write can be achieved with a single thread which does the following:

1. create channel
2. connect the channel
3. create a selector
4. register the selector to the channel
5. set interest ops to OP_READ and OP_WRITE
6. run in a loop to handle READ and WRITE

Besides, is it possible to write to channel.socket() directly without going through selector. That is the loop in 6 above only handle READ operation while calling a separate function in the same thread and write to channel.socket().write(...)

Thanks!
[Message sent by forum member 'waikeichan' (waikeichan)]

http://forums.java.net/jive/thread.jspa?messageID=297587