Index: F:/svn/grizzly/modules/grizzly/src/main/java/com/sun/grizzly/util/OutputWriter.java =================================================================== --- F:/svn/grizzly/modules/grizzly/src/main/java/com/sun/grizzly/util/OutputWriter.java (revision 394) +++ F:/svn/grizzly/modules/grizzly/src/main/java/com/sun/grizzly/util/OutputWriter.java (working copy) @@ -86,14 +86,13 @@ try { while ( bb.hasRemaining() ) { int len = socketChannel.write(bb); - attempts++; - if (len < 0){ - throw new EOFException(); - } - - bytesProduced += len; - - if (len == 0) { + if (len>0){ + attempts = 0; + bytesProduced += len; + }else { + //handle write count = 0;NOTE write() return result >=0, no <0 exist. + attempts++; + if ( writeSelector == null ){ writeSelector = SelectorFactory.getSelector(); if ( writeSelector == null){ @@ -111,8 +110,7 @@ } else { attempts--; } - } else { - attempts = 0; + //handle write count = 0 end; } } } finally {