www.pudn.com > 221315556.rar > SocketEvent.h
#pragma once #include#include "socket.h" #include "support.h" #ifdef FD_SETSIZE #undef FD_SETSIZE #define FD_SETSIZE 1024 #endif #define FDSETCOUNT ((2000+FD_SETSIZE)/FD_SETSIZE) class CSocketEvent { typedef struct __fdset { u_int fd_count; SOCKET fd_array[FD_SETSIZE]; //UINT fd_flag[FD_SETSIZE]; }__fd_set; public: CSocketEvent(void); virtual ~CSocketEvent(void); private: __fd_set m_Fdsets[FDSETCOUNT]; __fd_set m_ReadFds[FDSETCOUNT]; // __fd_set m_WriteFds[FDSETCOUNT]; // __fd_set m_ExceptFds[FDSETCOUNT]; SOCKET m_fds[FD_SETSIZE]; UINT m_Count; public: BOOL Clean(); UINT Add(SOCKET s, UINT flag); BOOL Del(SOCKET s, UINT id); BOOL CanRead(SOCKET s, UINT id); UINT GetReadSocket(SOCKET* sBuffer, UINT* iBuffer); VOID UpdateRead(void); };