* select function question
@ 2004-10-01 21:51 Ameer Armaly
2004-10-02 20:45 ` Jan-Benedict Glaw
0 siblings, 1 reply; 2+ messages in thread
From: Ameer Armaly @ 2004-10-01 21:51 UTC (permalink / raw)
To: linux-c-programming
Hi all.
I have some question about select:
1. one of the parameters is called writefds; what does this mean?
2. what does exceptfds mean?
3. how do I automatically know when an fd has new data?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: select function question
2004-10-01 21:51 select function question Ameer Armaly
@ 2004-10-02 20:45 ` Jan-Benedict Glaw
0 siblings, 0 replies; 2+ messages in thread
From: Jan-Benedict Glaw @ 2004-10-02 20:45 UTC (permalink / raw)
To: linux-c-programming
[-- Attachment #1: Type: text/plain, Size: 1440 bytes --]
On Fri, 2004-10-01 17:51:08 -0400, Ameer Armaly <ameer@charter.net>
wrote in message <Pine.LNX.4.61.0410011749450.20884@debian>:
> I have some question about select:
> 1. one of the parameters is called writefds; what does this mean?
The first set contains file descriptors you don't want to block upon
read(). The second set (writefds) contains a set of file descriptors you
don't want to block upon write(). Consider pipes or something like that
with a limited local buffer (on the kernel side).
> 2. what does exceptfds mean?
Never used these, but I guess these would make some sense in connection
to timed out network sockets or the like.
> 3. how do I automatically know when an fd has new data?
Actually, you don't:-) select() will only tell you that you won't block
at the next read() or write() call. It doesn't actually mean that you
really can read any data from it -- it may return an error and set errno
instead!
However, for some file descriptor types (ie. serial ports or network
sockets) there are ways to determine if there's actually data available.
MfG, JBG
--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
fuer einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-10-02 20:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-01 21:51 select function question Ameer Armaly
2004-10-02 20:45 ` Jan-Benedict Glaw
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).