apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Learning apr <learning_...@hotmail.co.uk>
Subject Could not get IP address with the function apr_sockaddr_ip_get
Date Wed, 02 Apr 2008 12:54:08 GMT

   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
Mime
View raw message