Path: utzoo!attcan!uunet!snorkelwacker!usc!rutgers!mcnc!uvaarpa!mmdf From: worley@compass.com (Dale Worley) Newsgroups: comp.lang.perl Subject: Async reading from two sockets? Message-ID: <1990Sep26.125039.19694@uvaarpa.Virginia.EDU> Date: 26 Sep 90 12:50:39 GMT Sender: mmdf@uvaarpa.Virginia.EDU (Uvaarpa Mail System) Reply-To: worley@compass.com Organization: The Internet Lines: 18 From: ckd@cs.bu.edu (Christopher Davis) I have a program which binds two sockets, which we can call FOO and BAR. I want to read from *both* of them asynchronously as the information comes in. I'm used to using while() to get information from one, but how do I read from whichever one has data? Use select() with four arguments. It allows you to wait for I/O to be ready on any combination of filehandles, and returns telling you which ones are ready. Dale Worley Compass, Inc. worley@compass.com -- Necessity is the plea for every infringement of human freedom. It is the argument of tyrants; it is the creed of slaves. -- William Pitt