[ale] Select()

Chris Fowler cfowler at outpostsentinel.com
Mon Aug 16 15:51:56 EDT 2010


That is the highest number of FD you want to select on.

If you want to select on 0 (STDIN) and 1 (STDOUT) then MAXFD needs to be
1 (highest FD) + 1 = 2.  MAXFD needs to be 2.  That will allow you to
select on 0 and 1.



On Mon, 2010-08-16 at 15:23 -0400, Calvin Harrigan wrote:
> I'm taking a long overdue plunge back into linux C programming.  While 
> reading the man page for select(), I came across a line that has me a 
> bit confused.
> 
> http://linux.die.net/man/2/select
> 
> "nfds is the highest-numbered file descriptor in any of the three sets, 
> plus 1."
> 
> What exactly are they referring to? What is highest-numbered file 
> descriptor?  Are they referring to integer value stored in the file 
> descriptor? Perhaps it's the number of file descriptors added to the 
> set?  It's not very clear to me.  Any insight would be greatly appreciated.
> 
> Thanks
> 
> 
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo




More information about the Ale mailing list