[MUD-Dev] Re: TECH: Distributed Muds
Jon Lambert
tychomud at ix.netcom.com
Fri Apr 27 15:38:45 CEST 2001
Caliban Tiresias Darklock wrote:
> On Thu, 26 Apr 2001 22:52:03 -0400, "Derek Snider"
> <derek at idirect.com> wrote:
>> Why not use select() to delay?
> Because select() is not a delay function. It's a network I/O
> function. If you are not doing network I/O, use a different
> function -- sleep() comes to mind.
> It's a religious issue, though.
This from the Winsock Lame List
(90% of the list applies to Unices as well)
-------cut------
1) Calling select() with three empty fd_sets and a valid TIMEOUT
structure as a sleazy delay function. Inexcusably lame.
Reason: The select() function is intended as a network function, not
a general purpose timer.
Alternative: Use a legitimate system timer service.
<snip>
23) select(). Self abusively lame.
Reason: Consider the steps involved in using select(). You need to use
the macros to clear the 3 fd_sets, then set the appropriate fd_sets
for each socket, then set the timer, then call select(). Then after
select() returns with the number of sockets that have done something,
you need to go through all the fd_sets and all the sockets using the
macros to find the event that occurred, and even then the (lack of)
resolution is such you need to infer the event from the current socket
state.
Alternative: Use asynchronous operation mode or overlapped I/O.
------end cut------
*nix select is similarly challenged...
The issue has come up here before:
http://www.kanga.nu/archives/MUD-Dev-L/1998Q2/msg01208.php
I posted a hypothetical model for *nix using blocking sockets and
threads here. It was shot down as inexcusably lame, so I won't bother
searching for a link. :-P
Any new ideas on efficient network designs that handle large numbers
of sockets?
Is there any work being done in *nix on a TCP stack that supports
asynchronous I/O functions?
--
--* Jon A. Lambert - TychoMUD Email:jlsysinc at ix.netcom.com *--
--* Mud Server Developer's Page <http://tychomud.home.netcom.com> *--
--* If I had known it was harmless, I would have killed it myself.*--
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev
More information about the mud-dev-archive
mailing list