Please check out Ancient Anguish !

Member Discussions

terms



[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]


1. Descriptor Polling Thu Jan 22, 2004 [12:58 PM]
maelf
maelfius@johnston.redlands.edu
member since: Oct 15, 2002
Reply
I am in-process of a custom mudserver ( I think this sou;d be in
advanced coding forum, but i'll try here first). I am pondering if it would
be more efficient to do a getdtablesize() for the max_descriptor on the
select() or if it would make more sense to simply increment the
max_descriptor for player sockets. Any input would be helpful. I would
think in one sense that the getdtablesize() would be better as it would
give you the maximum file descriptors the process could handle, and
would circumvent the need to increment and decrement the max as you
open and close connections. However, I am unfamiliar if this would
cause any bloat/other issues directly with the select() poll.

Thank you,
Maelfius


2. RE: Descriptor Polling Thu Jan 22, 2004 [1:25 PM]
jobo
Email not supplied
member since: May 25, 2000
In Reply To
Reply
The resources spent check a few extra numbers doesn't matter. Either go with getdtablesize() or use the FD_SETSIZE macro. Having to bother with increasing and decreasing some integer each time you open and close a socket isn't worth the bother.

Brian


3. RE: Descriptor Polling Thu Jan 22, 2004 [1:50 PM]
maelf
maelfius@johnston.redlands.edu
member since: Oct 15, 2002
In Reply To
Reply
Thanks. I'll use getdtablesize then. Wasn't real sure about that.


4. RE: Descriptor Polling Thu Jan 22, 2004 [3:17 PM]
Fire
tacodog21@yahoo.com
member since: Feb 29, 2000
In Reply To
Reply
I use getdtablesize (http://www.mcsr.olemiss.edu/cgi-bin/man-cgi?getdtablesize+2) myself, but not sure about portability issues. I only run SuSE Linux on my personal computer, so I'm not concerned about portability. However, I heard that the Linux kernel sets the max to 1024 anyway, so if you have a hard number like that, why bother with checking it?
Included in that link above is a reference to getdtablehi, would that be sort of like incrementing/decrimenting the max socket variable without having to do it manually each time you get a new descriptor?
Comments anyone?
Never use a big word when a diminutive one will suffice.


5. RE: Descriptor Polling Fri Jan 23, 2004 [2:19 AM]
Tyche
Email not supplied
member since: Apr 4, 2000
In Reply To
Reply
Just for portability sake I'd mention that FD_SETSIZE is portable to Windows, getdtablesize() isn't, FD_SETSIZE defaults to 64 but can be changed the same way it's changed in Unix via a #define, and that select() under Windows completely ignores the first parameter as fd sets are implemented in such a way as to not need to know it.
The Sourcery - http://sourcery.dyndns.org
TeensyMud - http://teensymud.kicks-ass.org
"A man can receive nothing, except it be given him from heaven."




[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]