This content has been marked as final. Show 4 replies
Use a single selector.
The client doesn't know what mode the server is in, and vice versa. It's not a problem.
that's what i'm using now, a single selector, but i want to know if two selector, one for each port, can boost performance or it still the same?
The only thing it can boost performance of is the accept() process, and you wouldn't call that a bottleneck. Not with only 2 listening ports. If you had 1000 it might become an interesting question but I doubt that either implementation would be significantly better. The whole idea of NIO is to handle multiple channels in one thread.1 person found this helpful
Ok understood :)