I have a list of sockets that belongs to a single thread. But I wonder is there a feasible way to communicate (read/write from/to) with those those clients? I don't want to create one thread for each client because there may be too much users and creating one thread for each of them may be too costly.
I'd say NIO is your best bet here. Check out one of the many good tutorials for NIO communications over a socket (well, SocketChannel)!
I believe this is the tutorial that I used when I had to learn NIO: http://rox-xmlrpc.sourceforge.net/niotut/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With