users@glassfish.java.net

Re: Java NIO question

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Mon, 08 Sep 2008 10:48:42 -0400

Salut,

forwarding to the proper list. Will reply from there :-)

Thanks

-- Jeanfrancois

glassfish_at_javadesktop.org wrote:
> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>