Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Apr 1996 10:55:54 -0300 (EST)
From:      "Lenzi, Sergio" <lenzi@cwbone.bsi.com.br>
To:        Marc van Kempen <marc@bowtie.nl>
Cc:        questions@FreeBSD.ORG
Subject:   Re: select question
Message-ID:  <Pine.BSF.3.91.960410105352.1459E-100000@lenzi>
In-Reply-To: <199604092143.XAA11392@nietzsche.bowtie.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 9 Apr 1996, Marc van Kempen wrote:

> 
> Hi,
> 
> This is not really FreeBSD related, unless it's a FreeBSD bug. But
> I wonder under which conditions a select will fail?
> 
> I have opened a comport read-write and want to wait for characters
> to become available, so I do a:
> 
>   tm.tv_sec = 0;
>   tm.tv_usec = timeout;         /* timeout to wait for reply */
>   FD_ZERO(&readfds);            /* clear the read filedescriptor set */
>   FD_SET(_comfd, &readfds);     /* select the _comfd to wait for */
>   if (select(1, &readfds, NULL, NULL, &tm)) {
               ^
the select call should be:select(_comfd+1,&readfds....)

I use this way and it works.


Sergio lenzi.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.960410105352.1459E-100000>