Re: macnetworkprog digest, Vol 3 #556 - 5 msgs
Re: macnetworkprog digest, Vol 3 #556 - 5 msgs
- Subject: Re: macnetworkprog digest, Vol 3 #556 - 5 msgs
- From: Larry Gerndt <email@hidden>
- Date: Mon, 20 Oct 2003 23:12:45 -0700
>
>> FD_SET(cookie->fSocket, &rdset);
>
>>
>
>> err = select(1, &rdset, NULL, NULL, &tv);
>
>
>
> This should be:
>
>
>
> err = select(cookie->fSocket + 1, &rdset, NULL, NULL, &tv);
>
>
>
> Check the man page for select for details.
>
>
I checked the man page but the description what the nfds is is
>
confusing: "The first nfds descriptors are checked in each set; i.e.,
>
the descriptors from 0 through nfds-1 in the descriptor sets are
>
examined."
>
>
I misunderstood the sentence.
I made this same mistake a couple days ago. I thought the first parameter
was meant to denote how many fd's were in the set I was passing to it, but
no, that's not true. Instead, it is the maximum fd that select will check,
and it will check every fd between 0 and nfds-1. Then you check the result
by using the macro's (i.e. FD_IS_SET or something).
--
Larry Gerndt
AIM Handle: SonOfTheSonOfMan
Let the truth be told though the heavens fall -- James Garrison
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.