Exemplo n.º 1
0
Arquivo: srpc.c Projeto: fergul/SRPC
int rpc_init(unsigned short port) {
    char *s = getenv("CACHE_IPV4_ADDRESS");

    debugf("rpc_init() entered\n");
    ctable_init();
    stable_init();
    if (s != NULL) {
        strcpy(my_address, s);
    } else {
        get_ipv4_addr(my_address);
    }
    return common_init(port);
}
Exemplo n.º 2
0
Arquivo: srpc.c Projeto: dellswor/SRPC
int rpc_init(unsigned short port) {
    char host[128];
    struct hostent *hp;

    debugf("rpc_init() entered\n");
    ctable_init();
    stable_init();
    gethostname(host, 128);
    hp = gethostbyname(host);
    if (hp != NULL) {
        struct in_addr tmp;
        memcpy(&tmp, hp->h_addr_list[0], hp->h_length);
        strcpy(my_name, inet_ntoa(tmp));
    } else
        strcpy(my_name, "127.0.0.1");
    return common_init(port);
}