Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!wrdis01!gatech!bloom-beacon!eru!hagbard!sunic!mcsun!hp4nl!integow!theo From: theo@integow.uucp (Theo Hardendood) Newsgroups: comp.unix.programmer Subject: Re: Understanding select... Message-ID: <1580@integow.uucp> Date: 18 Apr 91 08:40:56 GMT References: <533@shrike.AUSTIN.LOCKHEED.COM> Organization: Integrity BV, Woerden, the Netherlands Lines: 35 From article <533@shrike.AUSTIN.LOCKHEED.COM>, by dcj@AUSTIN.LOCKHEED.COM (David Jacobson rimux): > I would like to use the select command to sit on a serial device > object descriptor (fd) and come off the select when any data has come > in. > > Q1: Is this possible? > Yes (although I read somewhere that not all devices support select calls) > descriptor. Unfortunately, my program sits on my select and never comes > off. > > Q2: Do you see the error in my concept of select or in my code below? > ... (some stuff deleted) > > FD_ZERO(&readmask); > FD_SET(fd, &readmask); > maxfdp1 = fd++; ^^^^ This must be: maxfdp1 = fd + 1; Hope this helps! -- UUCP: ..!uunet!mcsun!hp4nl!integow!theo or theo@integow.uucp Theo Hardendood, Sr. software engineer, Integrity software consultants, Pelmolenlaan 2, 3447 GW Woerden, The Netherlands. tel +31 3480 30131, fax +31 3480 30182