How do we implement functionality like C's select() system call in Java?

Tim Rohaly

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.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact