// //finds the highest socket number and sets the rset and wset bits //from our list of clients and our listening socket. // int SimpleServer::getMaxFD() { int imax = m_sListen; ServerSocket* s; FD_ZERO(&m_wset); FD_ZERO(&m_rset); if(!m_bUsingThread) { //when we are using threads, this simple server object is only //paying attention to one socket. Other simple server objects //will pay attention to other sockets. Listen socket is taken //care of in the manager. FD_SET(m_sListen,&m_rset); //select on listening socket } for(s = m_listClients.getHead(); s; s = m_listClients.getNext()) { FD_SET(*s,&m_rset); //select for readability if(s->getOutBufferSize()) FD_SET(*s,&m_wset); //need to send data out, select for writability if((int)(*s) > imax) imax = *s; } return imax; }