S
Shane Wealti
I have the O'Reilly Book Java NIO (with the mouse on it) and I'm trying
to figure out how to do non-blocking socket i/o. Basically I want to
have some subroutine to be called whenever there is data available to
read on a socket object without having to poll it. I'm having trouble
understanding how to do this in Java and the NIO book isn't really
helpful in that regard. Right now the way I have my program written is
that I spawn a separate thread that has a while loop that checks the
socket for data and then goes to sleep for a while but that doesn't
seem like a very efficient implementation. I'm having trouble finding
much information on NIO, especially tutorials and code samples that
deal with this.
to figure out how to do non-blocking socket i/o. Basically I want to
have some subroutine to be called whenever there is data available to
read on a socket object without having to poll it. I'm having trouble
understanding how to do this in Java and the NIO book isn't really
helpful in that regard. Right now the way I have my program written is
that I spawn a separate thread that has a while loop that checks the
socket for data and then goes to sleep for a while but that doesn't
seem like a very efficient implementation. I'm having trouble finding
much information on NIO, especially tutorials and code samples that
deal with this.