On Wed, Apr 23, 2008 at 1:04 PM, Nigel Hsiung <nigelcz at hotmail.com> wrote: > > This worked for me - > > pj_in_addr hostip; > > pj_gethostip(&hostip); > if (pj_gethostip(&hostip) == PJ_SUCCESS){ > printf("my ip = %s", pj_inet_ntoa(hostip.sin_addr)); > } > Yep. Or with the latest version where the function has been modified to support IPv6: #include <pj/addr_resolv.h> pj_sockaddr addr; int af; af = pj_AF_INET(); // or pj_AF_INET6 for IPv6 if (pj_gethostip(af, &addr) == PJ_SUCCESS) { char ipaddr[PJ_INET6_ADDRSTRLEN]; printf("my ip=%s\n", pj_sockaddr_print(&addr, ipaddr, sizeof(ipaddr), 0)); } Cheers Benny