Re: Network Programming Models (was OTCountFreeBytes?)
Re: Network Programming Models (was OTCountFreeBytes?)
- Subject: Re: Network Programming Models (was OTCountFreeBytes?)
- From: Becky Willrich <email@hidden>
- Date: Mon, 4 Feb 2002 11:43:41 -0800
o You can only select on a limited number of file descriptors
simultaneously. This limit, FD_SETSIZE, is currently 1024, which is
way too limiting for a serious server product.
This is actually a limitation of the FD_SET macros; the actual functions
don't have this limitation, so you can workaround by implementing your
own bit-flag sets (which would have to dynamically reallocate as more
sockets were added to the set). You can check out a recent
implementation of CFSocket in Darwin for an example of how to do this.
That said, I must agree that the bit-flag approach is not the nicest.
I will add my own pet-peeve about select, which is that it's a pain to
interrupt in any fashion. The normal trick to deal with this is to open
a socket to yourself (and then add that socket to the read set going in
to select), so that you can force the select to return by writing in to
the socket.
REW