一个select 模型,最大支持64.。。在WINDOWS下 对不?  LINUX1024我如果要超过64应该怎么做呢? select应该如何写啊?fd_set fdset;  fdset 改成数组就行了???

解决方案 »

  1.   

    Four macros are defined in the header file Winsock2.h for manipulating and checking the descriptor sets. The variable FD_SETSIZE determines the maximum number of descriptors in a set. (The default value of FD_SETSIZE is 64, which can be modified by defining FD_SETSIZE to another value before including Winsock2.h.) 
      

  2.   

    1楼,你好像没看懂我的意思!3楼,我知道设置 请问下 不使用多个fd_set 只用一个 然后改变他FD_SETSIZ 的大小。。会对效率有影响不?
      

  3.   

    windows下用IOCP模型
    linux下epoll?
      

  4.   

    超过64也没关系,多收几次拼起来就成.缓存再大也没用,因为tcp/ip的包长有协议,换个说法,你可以定义宽缓存,但网卡宽度没变.
      

  5.   


    多线程就可以了,但是select这种模型很明显不应该用在大用户连接这种应用上
      

  6.   

    (1)在linux下,修改内核,让select支持1024以上的
    (2)多进程或者多线程的方式,即用多个select去处理,这样就支持更多个连接了
    (3)采用poll,或者epoll。
    个人觉得用epoll或者windows下的iocp更好