I am developing an android application where it has to talk to multiple TCP based servers in run time. Now i am using java sockets to communicate and threads to handle multiple clients. But there is a requirement in application that we need to talk to more numbers of servers in run time. So i am using the concept of Java NIO with selectors to handle multiple servers at a time. But the problem now i am facing is that i am not able to communicate with any of the servers. So please any one suggest can i use selector at client side.
Asked
Active
Viewed 301 times
1 Answers
1
You can use Selectors, but they add complexity to your coding. I suggest you use a library like netty or mina to manage this for you.
An alternative is to use blocking NIO which is much simpler to use IMHO and have multiple threads. On a PC this can handle up to 1000 connections and on an Android device it might handle tens or so.

Peter Lawrey
- 525,659
- 79
- 751
- 1,130