serverspy/src/serverspy.cxx
//------------------------------------------------------------------------------
// This procedure will create a listen socket for client requests 
// channel and for admin requests channel
//------------------------------------------------------------------------------
This procedure will create a listen socket for client requests
channel and for admin requests channel
This procedure will create a listen socket for client requests channel and for admin requests channel
int CreateListener() {
    int sock;
    struct sockaddr_in name;
    sock = create_socket();
    if (sock < 0) return -1;
    unsigned int set_option = 1;
    setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&set_option, sizeof(set_option));
    name.sin_family      = AF_INET;
    name.sin_port        = 0;
    name.sin_addr.s_addr = htonl(INADDR_ANY);
    if (bind (sock, (struct sockaddr *) &name, sizeof (name)) < 0)
        return -1;
    if(listen(sock, 5) < 0) return -1;
    return sock;
}
int CreateListener ( ) { int sock ; struct sockaddr_in name ; sock = create_socket ( ) ; if ( sock < 0 ) return -1 ; unsigned int set_option = 1 ; setsockopt ( sock , SOL_SOCKET , SO_REUSEADDR , ( const char * ) & set_option , sizeof ( set_option ) ) ; name . sin_family = AF_INET ; name . sin_port = 0 ; name . sin_addr . s_addr = htonl ( INADDR_ANY ) ; if ( bind ( sock , ( struct sockaddr * ) & name , sizeof ( name ) ) < 0 ) return -1 ; if ( listen ( sock , 5 ) < 0 ) return -1 ; return sock ; }
This procedure will create a listen socket for client requests
channel and for admin requests channel
This procedure will create a listen socket for client requests channel and for admin requests channel
/* Create the socket. */ /* Give the socket a name. */