0
votes

I am trying to understand select() and non-blocking I/O concept. but still not got what will happen if use Blocking I/O with select() and what about if use non-blocking with select().

I read, select() is already block call. then how does it works?

2

2 Answers

0
votes

what will happen if use Blocking I/O with select()

You will get an IllegalBlockingModeException.

select() is already block call. then how does it works?

It blocks until an event that is being selected on occurs, or the timeout expires, if any.

0
votes

It is perfectly fine to use select() or poll() with blocking or non-blocking sockets. Call to select() itself will be blocked until (one of the) socket(s) provided to select() will become available for reading.