Re: HELP: select() under sockets


Ben Cranston (zben@umd5.umd.edu)
8 Sep 87 19:45:26 GMT


In article <8709061618.AA14584@topaz.rutgers.edu> ron@TOPAZ.RUTGERS.EDU (Ron Natalie) writes:
> The definition of the first argument to the socket is the maximum file
> descriptor that can be specified in any of the other fields. You set
> it to one ... Set the value to something
> larger like the maximum number of file descriptors (NFILE).

(Hiya Ron!) People have been talking about setting NFILE bigger than 32,
so I think it is worth mentioning that the first argument to select is used
to tell it the width of the bitmaps in the succeeding arguments. So if they
are INTs you probably want to set it to 32. Of course, if your system DOES
have NFILE set bigger than 32 and you happen to get a FD with a higher number,
that (1<<nfd) suddenly turns into a zero and the code no longer does what
one thought it would... So waddya want to do?

        if (nfd>31)
                diehorribly("fix this mess")
        else {
                num = select( 32 , (1<<nfd) , ...)
        }

or what? Idunno...

--
Copyright 1987 Ben Cranston (you may redistribute ONLY if your recipients can).
       umd5.UUCP    <=	    {seismo!mimsy,ihnp4!rlgvax}!cvl!umd5!zben
zben @ umd2.UMD.EDU	    Kingdom of Merryland UniSys	1100/92
       umd2.BITNET	    "via HASP with RSCS"



This archive was generated by hypermail 2.0b3 on Thu Mar 09 2000 - 14:39:15 GMT