Unix Programming - blocking sockets

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > September 2004 > blocking sockets





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author blocking sockets
j0mbolar

2004-09-22, 9:22 pm

do blocking sockets have an implicit select/poll mechanism?
Barry Margolin

2004-09-22, 9:22 pm

In article <2d31a9f9.0409200706.289564ef@posting.google.com>,
j0mbolar@engineer.com (j0mbolar) wrote:

> do blocking sockets have an implicit select/poll mechanism?


I guess that's a way to think of it.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
manu

2004-09-22, 9:22 pm

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

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com