Re: Maximum number of sockets
Re: Maximum number of sockets
- Subject: Re: Maximum number of sockets
- From: Dario <email@hidden>
- Date: Mon, 12 Jul 2004 23:31:52 +0200
Il giorno 12/lug/04, alle 23:22, Duane Murphy ha scritto:
>
--- At Mon, 12 Jul 2004 22:51:27 +0200, Dario wrote:
>
>
> Il giorno 12/lug/04, alle 22:34, Quinn ha scritto:
>
>
>
>> At 19:30 +0200 12/7/04, Dario wrote:
>
>>> And if the fd_set contains only 1024 fd, isn't it useless if it
>
>>> internally can use more ?
>
>>
>
>> Well, it depends on the scope of your program. If you're writing
>
>> code
>
>> that can operate within an arbitrary process (such as a generic
>
>> library), you would need to avoid fd_set. OTOH, most typical
>
>> applications never have more than 1024 descriptors open, so fd_set is
>
>> just fine.
>
>
>
> Then there is a thing i still can't understend, using select avoiding
>
> fd_set ?? you are talking about poll and kqueue right ?
>
>
This is getting funny, but I grow weary, as I am sure you are as well.
>
>
Here is the clue: if the system can handle an fd_set with more than
>
1024
>
bits, where would it come from?
>
>
How about allocating one of your own? Because the FD_* macros are bit
>
manipulation macros (and being in C), they don't check array bounds.
>
You
>
can create and fd_set as big as you want. It's just an array of longs.
>
>
fd_set my_fdset* = (fd_set*)malloc( howmany( 2048, NFDBITS );
>
>
Now you have an fd_set that points to 2048 sockets worth of bits.
>
>
Note: FD_COPY and FD_ZERO are the exceptions. The use sizeof() and
>
would
>
be wrong. They are also trivial to re-implement.
>
>
...Duane
>
Thanks :)
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.