わいえむねっと

Contents
Categories
Calendar
2007/04
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Monthly Archives
~2000/01
Recent Entries
RSS1.0
Templates
Information
Processed: 0.057 sec
Chashed: -
2007/04/15 Sun
好きなことしてるんだろ? いくら喰いたい。 ソケット数の制限とか。

Maximum Number of Sockets an Application Can Use
http://support.mi​crosoft.co​m/kb/111855/en-us
The maximum number of sockets that a Windows Sockets application can use is determined at compile time by the manifest constant FD_SETSIZE. To do this, from the Win32 SDK WINSOCK.H file:

This value is used in constructing the fd_set structures used in select(). The default value in WINSOCK.H is 64. If an application is designed to be capable of working with more than 64 sockets, define the manifest FD_SETSIZE in every source file before including WINSOCK.H. One way of doing this is to include the definition within the compiler options in the makefile, such as adding -DFD_SETSIZE=128 as an option to the compiler command line for Microsoft C.

64で足りなければFD_SETSIZEを増やせばいいじゃないと言っているけれど、MAXIMUM_WAIT_OBJECTSに関して同様の情報はなし。

WinNT.h
#define MAXIMUM_WAIT_OBJECTS 64 // Maximum number of wait objects

イベントで処理するためにはスレッドなりなんなりで階層化するしかないのか。
LinuxのFD_SETSIZEは、

sys/select.h
/* Get definition of needed basic types. */
#include <bits/types.h>

#define FD_SETSIZE __FD_SETSIZE

で、

bits/types.h
#include <bits/typesizes.h> /* Defines __*_T_TYPE macros. */

から、

bits/typesizes.h
#define __FD_SETSIZE 1024

と。glibc-2.3.4。
Windowsのデフォルトは小さすぎる。