[MUD-Dev] Re: TECH: Distributed Muds

Daniel.Harman at barclayscapital.com Daniel.Harman at barclayscapital.com
Wed May 2 11:13:59 New Zealand Standard Time 2001

On 01 May 2001 15:05, Chris Gray wrote
>> From: Daniel.Harman at barclayscapital.com

>> Under winNT, 2000 you really need to investigate 'completion ports'
>> if you intend to get efficient socket io. The multithreaded stuff
>> which is part of the winsock library doesn't really sit too well on
>> NT in terms of efficiency and NT style overlapped io is the way
>> forward. There should be at least a couple of articles on it in
>> MSDN, but its not a widely known technique.

> It's been a couple of years since I had to do some stuff under the
> WIN32 API, so what I'm saying here might be out of date. However, my
> strong recollection is that the WIN32 function which allows you to
> wait for activity from multiple handles has a hard limit of 64
> handles. To go beyond that, you need to have multiple threads doing
> waiting. This isn't an insurmountable problem, but it is something
> to be aware of when designing a system to use the WIN32 stuff. When
> using winsock, you have the opportunity to redefine MAX_FD to
> whatever you want.

There is a limit but it is the maximum sockets that can be waited on
simultaneously, not the max you can have. It can be changed by a
#define.  If you use completion ports then this is not an issue, only
if you use select().

Like I said, completion ports are the way forward under NT :)

8<----- MSDN ------

Maximum Number of Sockets Supported

The maximum number of sockets supported by a particular Windows
Sockets service provider is implementation specific. An application
should make no assumptions about the availability of a certain number
of sockets. For more information on this topic see WSAStartup
<wsapiref_1v8y.htm>.  The maximum number of sockets that an
application can actually use is independent of the number of sockets
supported by a particular implementation. The maximum number of
sockets that a Windows Sockets application can use is determined at
compile time by the manifest constant FD_SETSIZE. This value is used
in constructing the FD_SET structures used in select
<wsapiref_1ab6.htm>. The default value in Winsock2.h is 64. If an
application is designed to be capable of working with more than 64
sockets, the implementor should define the manifest FD_SETSIZE in
every source file before including Winsock2.h. One way of doing this
may be to include the definition within the compiler options in the
makefile. For example, you could add "-DFD_SETSIZE=128" as an option
to the compiler command line for Microsoft C. It must be emphasized
that defining FD_SETSIZE as a particular value has no effect on the
actual number of sockets provided by a Windows Sockets service
MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list