How do we implement functionality like C's select() system call in Java?
In C, select() is used to multiplex between open sockets. If a C program needs to read from two sockets, it can use select() to block until data is received on either, instead of having to block on one at a time.
Java does not have an equivalent for select(). However, select() is only one way to acheive this functionality. Another way is to have each socket read by a separate thread. This is considerably easier and cleaner to do in Java than in C, and obviates the need of a special select() function.