• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Repost: OpenTransport problems under X [solved]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Repost: OpenTransport problems under X [solved]


  • Subject: Re: Repost: OpenTransport problems under X [solved]
  • From: Larry Gerndt <email@hidden>
  • Date: Thu, 27 Nov 2003 22:37:40 -0800

From: Eli Green <email@hidden>:
> The first parameter to select isn't the number of sockets you pass it,
> it's the largest socket descriptor (minus one) it will check.

Indeed. And apparently a lot of newbies (myself included) make this same
mistake when they read the man page. When I realized my error, on 10/20/03,
I posted this:

>>>> 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.

  • Follow-Ups:
    • Re: Repost: OpenTransport problems under X [solved]
      • From: Quinn <email@hidden>
  • Prev by Date: Re: Repost: OpenTransport problems under X [solved]
  • Next by Date: Re: Repost: OpenTransport problems under X [solved]
  • Previous by thread: Re: Repost: OpenTransport problems under X [solved]
  • Next by thread: Re: Repost: OpenTransport problems under X [solved]
  • Index(es):
    • Date
    • Thread