On 08/22/2010 06:19 AM, Thomas Koch wrote:
If you could help me to move the logic from xyz() back in the run() method
with fitting calls to the socket() class, then I might be done. I'm a bit
puzzled because in NIO there's first a selector.select(to) and then
doWrites(), while in Netty there's first doWrites() and then
The control logic is indeed "swapped" here for nio/netty. In the NIO
case we have set flags that specify whether we are interested in
performing writes or not (nio will return once a socket we've expressed
interest in is available to write, it could return immediately). In
netty we have a queue of packets and write them to the channel (under
which I'm assuming netty does similar to what we are doing in our nio
code). The packet generating code will notify outgoing queue when new
packets are added to the queue.
In the NIO case we are essentially saying "wait to write until something
can be written", while in the netty case we are "write everything and
then wait until more packets are available to write".