Ignore:
Timestamp:
Sep 14, 2006 6:51:01 PM (18 years ago)
Author:
bennylp
Message:

Fix the local IP address resolution issue in PJSIP, PJMEDIA, and PJSUA, by adding a new API pj_gethostip() to resolve the default local IP address of local host. This new function will work even when local hostname resolution is not set correctly, by detecting the default IP interface in the system.

Also fix compile warnings in iLBC.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_transport_udp.c

    r635 r721  
    653653         */ 
    654654        if (tmp_addr.sin_addr.s_addr == PJ_INADDR_ANY) { 
    655             pj_hostent he; 
    656             const pj_str_t *hostname = pj_gethostname(); 
    657             status = pj_gethostbyname(hostname, &he); 
    658             if (status != PJ_SUCCESS) { 
    659                 pj_sock_close(sock); 
     655            pj_in_addr hostip; 
     656 
     657            status = pj_gethostip(&hostip); 
     658            if (status != PJ_SUCCESS) 
    660659                return status; 
    661             } 
    662             pj_strcpy2(&bound_name.host,  
    663                        pj_inet_ntoa(*(pj_in_addr*)he.h_addr)); 
     660 
     661            pj_strcpy2(&bound_name.host, pj_inet_ntoa(hostip)); 
    664662        } else { 
    665663            /* Otherwise use bound address. */ 
Note: See TracChangeset for help on using the changeset viewer.