> Ideally a single blocking operation that returned when the next request > is available would be best. My knowledge of NIO is pretty minimal, but > it seems like this should be an option.
I haven't followed the conversation fully, so my answer may have already been covered... but yes, what you're looking for exists. You must use the "nio" package that's new in Java 1.4. Specifically, the 'Selector' object ( http://java.sun.com/j2se/1.4.2/docs/api/java/nio/channels/Selector.html ) handles waiting until an event is available. Here's a quick example I found that illustrates using a non-blocking ServerSocket and accepting connections. http://javaalmanac.com/egs/java.nio/NbServer.html Here's another good article on NIO: http://www.onjava.com/pub/a/onjava/2004/09/01/nio.html . Using NIO involves more or a less a complete rewrite of any legacy I/O code if you want to be at all efficient. NIO makes use of 'Buffer' classes instead of InputStream/OutputStream, among many other changes to threading architectures, etc... A fellow by the name of Roger Kapsi contributed a 'DAAP' (Digital Audio Access Protocol) package to LimeWire that has a good abstraction for using blocking or non-blocking code. If you like, it's available online at http://limewire.org/fisheye/viewrep/misc/daap , or can be checked out of our CVS using :pserver:[EMAIL PROTECTED]:/cvs (password guest), and checking out the 'daap' module. Thanks, Sam --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
