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 Learn more!