Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!umd5!eneevax!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: HELP PLEASE: select() in BSD Message-ID: <8630@mimsy.UUCP> Date: Thu, 17-Sep-87 20:53:27 EDT Article-I.D.: mimsy.8630 Posted: Thu Sep 17 20:53:27 1987 Date-Received: Sat, 19-Sep-87 18:17:04 EDT References: <307@picuxa.UUCP> <891@mtund.ATT.COM> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 37 Keywords: poll Summary: How is this `better'? In article <891@mtund.ATT.COM> bfb@mtund.ATT.COM (Barry Books) writes: >[System] 5.3 includes a better select() called poll(). Poll takes >an array of pollfd's a long which is the number in the array and a >timeout in milliseconds. You can also get a signal when there is >something waiting to poll on. Select takes three pointers to `fd_set's, an int which specifies how many descriptors are described by the `fd_set's, and a timeout in microseconds. You can also get a signal (SIGIO) when a descriptor is ready. So what makes poll better? For the original poster: int select(int nfd, fd_set *r, fd_set *w, fd_set *ex, struct timeval *timeout) or (4.2BSD) int select(int nfd, int *r, int *w, int *ex, struct timeval *timeout) returns the number of descriptors that are ready for r(eading), w(riting), or that have ex(ceptions), returning within the time limit given by timeout, or waiting until at least one is ready if timeout==NULL. select always returns immediately if at least one descriptor is ready. *r, *w, and *ex are modified before select returns to reflect which descriptors in fact were readable or writable or had exceptional conditions pending. [Okay, Exceptional Conditions amount to out of band data on sockets.] -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris