libs/nameserver/src/nameServCalls.cxx
// Function connects to name server and asks if for specified service
// returns 1 on success and sets up "service_port" and "tcp_addr"
// returns 0 if no service found
// returns -1 if unable to connect to name server
Function connects to name server and asks if for specified service
returns 1 on success and sets up "service_port" and "tcp_addr"
returns 0 if no service found
returns -1 if unable to connect to name server
Function connects to name server and asks if for specified service returns 1 on success and sets up " service_port " and " tcp_addr " returns 0 if no service found returns - 1 if unable to connect to name server
int NameServerGetServiceRemote(const char *host, const char *name, int &service_port, int &tcp_addr)
{
    unsigned char cmd;
    int sock = ConnectToNameServerRemote(host);
    if(sock < 0)
	return -1;
    if(!SendCommand(sock, FIND_SERVER))
	return -1;
    if(!SendString(sock, name)) {
	closesocket(sock);
	return -1;
    }
    if(!ReceiveCommand(sock, &cmd)) {
	closesocket(sock);
	return -1;
    }
    if(cmd == 0){
	closesocket(sock);
	return 0;
    }
    if(!ReceiveInteger(sock, &service_port)) {
	closesocket(sock);
	return -1;
    }
    if(!ReceiveInteger(sock, &tcp_addr)) {
	closesocket(sock);
	return -1;
    }
    closesocket(sock);
    return 1;
}
int NameServerGetServiceRemote ( const char * host , const char * name , int & service_port , int & tcp_addr ) { unsigned char cmd ; int sock = ConnectToNameServerRemote ( host ) ; if ( sock < 0 ) return -1 ; if ( ! SendCommand ( sock , FIND_SERVER ) ) return -1 ; if ( ! SendString ( sock , name ) ) { closesocket ( sock ) ; return -1 ; } if ( ! ReceiveCommand ( sock , & cmd ) ) { closesocket ( sock ) ; return -1 ; } if ( cmd == 0 ) { closesocket ( sock ) ; return 0 ; } if ( ! ReceiveInteger ( sock , & service_port ) ) { closesocket ( sock ) ; return -1 ; } if ( ! ReceiveInteger ( sock , & tcp_addr ) ) { closesocket ( sock ) ; return -1 ; } closesocket ( sock ) ; return 1 ; }
Function connects to name server and asks if for specified service
returns 1 on success and sets up "service_port" and "tcp_addr"
returns 0 if no service found
returns -1 if unable to connect to name server
Function connects to name server and asks if for specified service returns 1 on success and sets up " service_port " and " tcp_addr " returns 0 if no service found returns - 1 if unable to connect to name server