private int write ( ByteBuffer outbuf ) { int nbytes ; try { nbytes = fd . write ( outbuf ) ; if ( nbytes == 0 ) { errno . set ( ZError . EAGAIN ) ; } } catch ( IOException e ) { errno . set ( ZError . ENOTCONN ) ; nbytes = - 1 ; } return nbytes ; }
of error or orderly shutdown by the other peer - 1 is returned .