Understanding select...
Theo Hardendood
theo at integow.uucp
Thu Apr 18 18:40:56 AEST 1991
>From article <533 at shrike.AUSTIN.LOCKHEED.COM>, by dcj at 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 at 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
More information about the Comp.unix.programmer
mailing list