serverspy/src/serverspy.cxx
//------------------------------------------------------------------------------
// This function is called by administrator to disconnect all clients 
// operating from the specified host (if this host is going to shut 
// down, for example)
//------------------------------------------------------------------------------
This function is called by administrator to disconnect all clients
operating from the specified host (if this host is going to shut
down, for example)
This function is called by administrator to disconnect all clients operating from the specified host ( if this host is going to shut down for example )
void AdminRemoveHostClients(int admin, char* host) {
    char reply[10000];
    char buf[100];
    struct hostent * hostdescr;
    ClientDescriptor *cli = ClientDescriptor::sd_list;
    reply[0]=0;
    while(cli != NULL){
        hostdescr = gethostbyaddr((char *)&cli->m_ClientTCP,4,AF_INET);
        if(strcmp(hostdescr->h_name,host)==0) {
            sprintf(buf,"Client %d disconnected.\n",cli->m_ID);
            strcat(reply,buf);
            ClientDescriptor::RemoveClient(cli->m_ID);
            cli = ClientDescriptor::sd_list;
            continue;
        }
        cli = cli->m_Next;
    }
    sendSafe(admin,reply,strlen(reply));
}
void AdminRemoveHostClients ( int admin , char * host ) { char reply [ 10000 ] ; char buf [ 100 ] ; struct hostent * hostdescr ; ClientDescriptor * cli = ClientDescriptor :: sd_list ; reply [ 0 ] = 0 ; while ( cli != NULL ) { hostdescr = gethostbyaddr ( ( char * ) & cli -> m_ClientTCP , 4 , AF_INET ) ; if ( strcmp ( hostdescr -> h_name , host ) == 0 ) { sprintf ( buf , " \n " , cli -> m_ID ) ; strcat ( reply , buf ) ; ClientDescriptor :: RemoveClient ( cli -> m_ID ) ; cli = ClientDescriptor :: sd_list ; continue ; } cli = cli -> m_Next ; } sendSafe ( admin , reply , strlen ( reply ) ) ; }
This function is called by administrator to disconnect all clients
operating from the specified host (if this host is going to shut
down, for example)
This function is called by administrator to disconnect all clients operating from the specified host ( if this host is going to shut down for example )