serverspy/src/serverspy.cxx
//------------------------------------------------------------------------------
// This function will wait any data on the client or admin socket
//------------------------------------------------------------------------------
This function will wait any data on the client or admin socket
This function will wait any data on the client or admin socket
void WaitForAnyInput(int client_sock, int admin_sock) {
    timeval timeout;
    timeout.tv_sec  = 1;
    timeout.tv_usec = 0;
    fd_set sock_set;
    int nfsd = 0;
#ifndef _WIN32
    nfsd = FD_SETSIZE;
#endif
    FD_ZERO(&sock_set);
    if (server_is_ready()) {
        FD_SET(client_sock, &sock_set);
        ClientDescriptor *cli = ClientDescriptor::sd_list;
        while(cli != NULL){
            FD_SET(cli->m_ClientSocket, &sock_set);
            FD_SET(cli->m_ServerSocket, &sock_set);
            cli = cli->m_Next;
        }
    }
    FD_SET(admin_sock, &sock_set);
    AdminDescriptor *admin = AdminDescriptor::admin_list;
    while(admin != NULL){
        FD_SET(admin->m_Socket, &sock_set);
        admin = admin->m_Next;
    }
#ifdef hp700
    select(nfsd,(int *)&sock_set,NULL,NULL,&timeout);
#else
    select(nfsd,&sock_set,NULL,NULL,&timeout);
#endif
}
void WaitForAnyInput ( int client_sock , int admin_sock ) { timeval timeout ; timeout . tv_sec = 1 ; timeout . tv_usec = 0 ; fd_set sock_set ; int nfsd = 0 ; #ifndef _WIN32 nfsd = FD_SETSIZE ; #endif FD_ZERO ( & sock_set ) ; if ( server_is_ready ( ) ) { FD_SET ( client_sock , & sock_set ) ; ClientDescriptor * cli = ClientDescriptor :: sd_list ; while ( cli != NULL ) { FD_SET ( cli -> m_ClientSocket , & sock_set ) ; FD_SET ( cli -> m_ServerSocket , & sock_set ) ; cli = cli -> m_Next ; } } FD_SET ( admin_sock , & sock_set ) ; AdminDescriptor * admin = AdminDescriptor :: admin_list ; while ( admin != NULL ) { FD_SET ( admin -> m_Socket , & sock_set ) ; admin = admin -> m_Next ; } #ifdef hp700 select ( nfsd , ( int * ) & sock_set , NULL , NULL , & timeout ) ; #else select ( nfsd , & sock_set , NULL , NULL , & timeout ) ; #endif }
This function will wait any data on the client or admin socket
This function will wait any data on the client or admin socket