/** * Initialize the socket module for outbound communications */ void Socket_outInitialize() { #if defined(WIN32) WORD winsockVer = 0x0202; WSADATA wsd; FUNC_ENTRY; WSAStartup(winsockVer, &wsd); #else FUNC_ENTRY; signal(SIGPIPE, SIG_IGN); #endif SocketBuffer_initialize(); #if !defined(USE_POLL) s.clientsds = ListInitialize(); s.connect_pending = ListInitialize(); s.write_pending = ListInitialize(); s.cur_clientsds = NULL; FD_ZERO(&(s.rset)); /* Initialize the descriptor set */ FD_ZERO(&(s.pending_wset)); s.maxfdp1 = 0; memcpy((void*)&(s.rset_saved), (void*)&(s.rset), sizeof(s.rset_saved)); FD_ZERO(&(s.pending_wset)); #else s.fds_tree = TreeInitialize(TreeSockCompare); s.epoll_fds = epoll_create(1024); s.cur_sds = 0; s.no_ready = 0; #endif s.newSockets = ListInitialize(); FUNC_EXIT; }
/** * Initialize the socket module */ void Socket_outInitialize() { #if defined(WIN32) || defined(WIN64) WORD winsockVer = 0x0202; WSADATA wsd; FUNC_ENTRY; WSAStartup(winsockVer, &wsd); #else FUNC_ENTRY; signal(SIGPIPE, SIG_IGN); #endif SocketBuffer_initialize(); s.clientsds = ListInitialize(); s.connect_pending = ListInitialize(); s.write_pending = ListInitialize(); s.cur_clientsds = NULL; FD_ZERO(&(s.rset)); /* Initialize the descriptor set */ FD_ZERO(&(s.pending_wset)); s.maxfdp1 = 0; memcpy((void*)&(s.rset_saved), (void*)&(s.rset), sizeof(s.rset_saved)); FUNC_EXIT; }