linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: linux-c-programming@vger.kernel.org
Subject: Re: select function question
Date: Sat, 2 Oct 2004 22:45:17 +0200	[thread overview]
Message-ID: <20041002204517.GS5033@lug-owl.de> (raw)
In-Reply-To: <Pine.LNX.4.61.0410011749450.20884@debian>

[-- 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 --]

      reply	other threads:[~2004-10-02 20:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-01 21:51 select function question Ameer Armaly
2004-10-02 20:45 ` Jan-Benedict Glaw [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041002204517.GS5033@lug-owl.de \
    --to=jbglaw@lug-owl.de \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).