linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ardhan Madras" <ajhwb@knac.com>
To: Randi Botse <nightdecoder@gmail.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: select() timeout question
Date: Fri, 27 Nov 2009 21:43:10 -0800	[thread overview]
Message-ID: <20091127214310.FCC998C@resin13.mta.everyone.net> (raw)

Hi Randi,

Basically the select syscall check the kernel buffer or in other words it just waiting to be notified by the kernel that there are pending data to read/write, it doesn't store any file-descriptor's related data.

                 - Ardhan


--- nightdecoder@gmail.com wrote:

From:	Randi Botse <nightdecoder@gmail.com>
To:	linux-c-programming@vger.kernel.org
Subject: select() timeout question
Date:	Wed, 25 Nov 2009 03:29:33 -0500

Hi All,

Im now learning the Linux's select() system call,

#include <sys/select.h>

int select(int fd, fd_set *rset, fd_set *wset, fd_set *excepfs, struct
timeval *timeout);

I want to receive notification when the given file descriptor is ready
to read, i use TCP socket connection to demonstrate this, one for the
sender and other for the receiver, with normal condition, when the
sender send data via write(), the select() returns and tell the
receiver there are data to read.

My question is: what happen when the receiver's select() is reaching
it's timeout while the sender send data? should the notification and
it's data lost (discarded)?

Based on my above experiment, select() never fail to notify although
it's in timeout state, and i awalys can read the data, i'm curious
with this, but i'm not sure if this always right.

Thanks before.

                                            Randi,
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html




_____________________________________________________________
Listen to KNAC, Hit the Home page and Tune In Live! ---> http://www.knac.com

             reply	other threads:[~2009-11-28  5:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-28  5:43 Ardhan Madras [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-11-25  8:29 select() timeout question Randi Botse
     [not found] ` <da5b0fda0911250038k4f6b87e7o3fd39e4c2db5ce86@mail.gmail.com>
2009-11-25  8:58   ` Randi Botse
2009-11-25  9:43 ` Michał Nazarewicz
2009-11-25 11:52   ` Randi Botse
2009-11-26  0:57 ` Helight.Xu

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=20091127214310.FCC998C@resin13.mta.everyone.net \
    --to=ajhwb@knac.com \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=nightdecoder@gmail.com \
    /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).