RT找了半天资料没找到如何封装select函数让他支持64个以上?求实际封装代码

解决方案 »

  1.   

    一般就是用多线程,每个select对应一个线程吧
      

  2.   


    使用select本来就是为了避免一个客户开一个线程的
    用select的话,一个线程可以处理64个客户的连接,如果超过64了,需要用新的线程来处理
      

  3.   

    #define FD_SETSIZE 1024
    #include <winsock2.h>一定要在 #include <winsock2.h>
    之上定义,因为 winsock2.h 有 #ifndef FD_SETSIZE
    #define FD_SETSIZE      64
    #endif /* FD_SETSIZE */
      

  4.   

    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.) 
    在引入Winsock2.h前,重定义 FD_SETSIZEhttp://topic.csdn.net/u/20110308/22/48e00c87-5716-4be8-9b6a-3563be5b2d70.html