socket server without *any* polling?
I've started experimenting with creating my own socket servers using Java, and I find the polling-vs.-socket argument ironic because all the Java examples I've seen use polling on the SERVER side. While polling on the client side leads to lower performance (low update frequency), polling on the server can eat up your CPU while effectively doing nothing.
Ok, I'm probably not being clear about this, but most Java examples tend to have a while(true) or equivalent section which just repeatedly checks the state of the socket buffer, waiting for data. This method works, but will eat up 25% of my CPU usage even though my server activity is completely idle. On principle alone, this is unacceptable. I'd like to write (or use) a socket server that is completely event-driven (perhaps this is accomplished with Java exceptions?) and will not burn cycles just waiting for something to happen.
How does ElectroServer (or similar product) deal with this? Does anyone have a Java example that doesn't poll the socket? Help! Thanks!!! :)