• 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
FD_SETSIZE > 1024 and select() break on intel ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FD_SETSIZE > 1024 and select() break on intel ?


  • Subject: FD_SETSIZE > 1024 and select() break on intel ?
  • From: Nicolas Berloquin <email@hidden>
  • Date: Thu, 12 Feb 2009 15:35:37 +0100

Hi !

I'm currently working on making an existing app a universal binary.
I have noticed that my select() code that worked fine in ppc stops working when running
on intel when I have more than 1024 active file descriptors (I'm accessing disk files
(sometime LOTS of them) and tcpip sockets).
Is there some detail that I'm missing ?
I checked and all my disk files are correctly opened (even if way over 1024), 
only my select call returns -1 (when it should return otherwise).
I see all my sockets with data waiting to be read when I run netstat at the same time...

here's what I do :
(I trimmed the code)

struct timeval  tv = {0, 0};

struct fd_set   *readfd_set = nil;

struct fd_set   *writefd_set = nil;

if (maxDescriptor > -1) {
readfd_set =(fd_set *)calloc(howmany(maxDescriptor + 2, NFDBITS), sizeof(int32_t));
writefd_set =(fd_set *)calloc(howmany(maxDescriptor + 2, NFDBITS), sizeof(int32_t));
} else {
return FALSE;
}

int numDescriptorSet = select(maxDescriptor + 1, readfd_set, writefd_set, nil, &tv);

numDesciptorSet is -1 100% of the time when maxDescriptor > 1024 !!

thanks for any tip !


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: FD_SETSIZE > 1024 and select() break on intel ? (case closed)
      • From: Nicolas Berloquin <email@hidden>
    • Re: FD_SETSIZE > 1024 and select() break on intel ?
      • From: Frederick Cheung <email@hidden>
  • Prev by Date: Re: Does CFSocket use efficient polling?
  • Next by Date: Re: FD_SETSIZE > 1024 and select() break on intel ?
  • Previous by thread: Re: Does CFSocket use efficient polling?
  • Next by thread: Re: FD_SETSIZE > 1024 and select() break on intel ?
  • Index(es):
    • Date
    • Thread