09-23-04 02:22 AM
j0mbolar wrote:
> do blocking sockets have an implicit select/poll mechanism?
Nope. It's just the way the sockets are implemented. It's very similar
to pipes. Your read/write system calls block at one end when the other
end is open. As soon as data comes, system call returns. Same thing
happens to sockets. A process which is waiting (sleeping) for data on
one socket is woken up by the kernel as soon as it gets the data for
that socket.
Unlike select/poll, kernel doesn't work on a set of descriptors here.
It just receives the data. This data goes to TCP layer which decides
which process and descriptors should get this data. And then if the
process is waiting to read the data, the read system call returns
otherwise this data is put in the buffer.
I hope this clears your doubt.
Cheers,
-Manu
---------
Manu Garg
http://manugarg.freezope.org
[ Post a follow-up to this message ]
|