From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: linux prg <linux-c-programming@vger.kernel.org>
Subject: Re: Returned mail: delivery problems encountered
Date: Thu, 28 Oct 2004 18:26:26 +0200 [thread overview]
Message-ID: <20041028162625.GG11105@lug-owl.de> (raw)
In-Reply-To: <1098934436.6437.7.camel@localhost.localdomain>
[-- Attachment #1: Type: text/plain, Size: 1711 bytes --]
On Wed, 2004-10-27 22:34:05 -0500, Edward Parrilla <eparrilla@comcast.net>
wrote in message <1098934436.6437.7.camel@localhost.localdomain>:
> > I have the following:
> > #define STDIN 0
Use STDIN_FILENO (unistd.h) instead of this hack.
> > /* .......*/
> >
> > int nfds;
> > struct timeval tv;
> > fd_set rfds;
> > fd_set afds;
> > FD_ZERO(&afds);
> > tv.tv_sec=0;
> > tv.tv_usec=0
> > FD_SET(STDIN, &afds);
> > FD_SET(msock, &afds);
> > nfds=getdtablesize();
> > msock=passiveTCP(service, 5); <--listening socket
> > while(1)
> > {
> > memcpy(&rfds,&afds, sizeof(rfds));
> > if (select(nfds, &rfds, (fd_set *)0, (fd_set *)0, &tv)<0)
> > errexit (" error ");
> > if (FD_ISSET(STDIN,&rfds)
> > handle(stdin);
> >
> >
> > /* it is not making to this line */ <-- here is the prolem, it does
> > not make to the next line, it does work to the line before(i.e. takes
> > input from STDIN), but it doesn't take something coming to the socket.
Glynn already pointed out that you FD_SET(msock) before you assign it.
Additionally, you're calling select() inside a loop. You actually need
to initialize tv.tv_sec, tv.tv_usec and afds _each time_ before calling
select(). So move that into the loop:-)
> > if (FD_ISSET(msock, &rfds))
> > {
> > handle _incoming _request()
> > }
> >
> > }
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 --]
prev parent reply other threads:[~2004-10-28 16:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2004102722581901500p7n00e@A@000000000000@comcast.net>
2004-10-28 3:34 ` Returned mail: delivery problems encountered Edward Parrilla
2004-10-28 5:42 ` Glynn Clements
2004-10-28 16:26 ` 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=20041028162625.GG11105@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).