Im working on a socket listener that has to listen on 2 ports for 2 types of data( port 80 and port 81). These data are very similar as in the kind of operations that are perfor
Many frameworks, such as Apache MINA and Netty, have been implemented based on Java NIO to boost non-blocking IO programming. I strongly recommend them to make your NIO programming a joy, rather than a nightmare. They fit your problem.
In addition, try to use an efficient protocol both in transport message size and encode/decode (serialize/deserialize) performance. Google Protocol Buffers is a reliable solution in this area. Also take a look at Kryo and KryoNet. They can be helpful.