You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Learning apr <le...@hotmail.co.uk> on 2008/04/02 14:54:08 UTC
Could not get IP address with the function apr_sockaddr_ip_get
Hello,
I hope to get the local host address by following codes. But I could not get it in the variable "ipAdd".
Please help me.
Thanks!
char hostName[APRMAXHOSTLEN + 1];
apr_sockaddr_t *sa;
apr_pool_t *pool;
char ipAdd[20];
apr_pool_create(&pool, 0);
apr_gethostname(hostName, APRMAXHOSTLEN + 1, NULL);
apr_sockaddr_info_get(&sa, hostName,APR_INET, 0, 0, pool);
memset(ipAdd, 0, 20);
apr_sockaddr_ip_get(&ipAdd, sa);
apr_pool_destroy(pool);
_________________________________________________________________
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE