Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!ames!sdcsvax!ucbvax!apolling.UUCP!geof From: geof@apolling.UUCP (Geof Cooper) Newsgroups: comp.protocols.tcp-ip Subject: Re: Re: HELP: select() under sockets Message-ID: <8709081702.AA00208@apolling.imagen.uucp> Date: Tue, 8-Sep-87 13:02:44 EDT Article-I.D.: apolling.8709081702.AA00208 Posted: Tue Sep 8 13:02:44 1987 Date-Received: Wed, 9-Sep-87 06:17:53 EDT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: imagen!geof@decwrl.dec.com Organization: The ARPA Internet Lines: 37 > 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 (presumably because you are assuming the value was supposed to > be the number of things selecting on). Setting this value to one means > that you can only select on file descriptor 0. Set the value to something > larger like the maximum number of file descriptors (NFILE). Umm, I just looked into /usr/include/stdio.h on our apollo system: Changelog entry: 10/01/82 jrw increased _NFILE from 20 to 128..... So using NFILE is probably NOT the way to go, unless you declare readfds, et al as arrays (this leads one to wonder, of course, why the existing apollo software works at all -- since I know of no code that actually uses arrays with select. Probably because no one actually opens more than 32 file descriptors and only THEN creates a socket...). In a separate note to Mr. Widdowson, I suggested: min( 8 * (sizeof readfds), NFILE ) so that the argument really does reflect the size of the data being passed to it. Actually, 8 * (sizeof readfds) is probably sufficient, since you will never actually turn on a bit that is beyond NFILE (hmmm... maybe little-endian vs big-endian affects things... comments?). Unfortunately, this is non-portable, since the size of a char is not necessarily 8 bits. But I suspect that all network software would break if char != octet. - Geof