Java NIO: calling selector.select() before socketChannel.write()

Sergey Marakhov <[email protected]> Sun, 13 Apr 2008 20:50:33 -0700
Newsgroups gmane.comp.windows.devel.java.advanced
Message-ID <D3149E217D25964D8EF6FA8BA2C32EF10226A2C26E@alvxmbw02.prod.quest.corp>
Hi all.

I'm looking at ways to simplify our current implementation of socket communications between an agent and multiple clients. There is a client connection object created per connected client, client connection is passed through an "incomingSelector" and each client connection opens its own outgoing selector. So, question 1: do I need to create separate outgoing selectors, or is using a single selector for both in and out operations is the way to go?

Next, before each invocation of socketChannel.write(...) method, we do outgoingSelector.select(). Is it necessary to do select() before write operations?

Our knowledge of NIO is rather limited, hence all this questions.

Much appreciated...

Thank you,
Sergey Marakhov
Phone: (613) 9811 8083
Quest Software


===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com