#include <stdio.h>      /* for fprintf() */
#include <netdb.h>      /* for gethostbyname() */
#include <stdlib.h>     /* for exit() */

unsigned long ResolveName(char name[])
{
    struct hostent *host;            /* Structure containing host information */
                                     /*the char **h_addr_list field of the structure
                                       contains a list a 32 bit binary addresses */

    if ((host = gethostbyname(name)) == NULL)
    {
        fprintf(stderr, "gethostbyname() failed");
        exit(1);
    }

    printf("ResolveName:  h_name: %s, addrType:%d, addrLength:%d\n",host->h_name,host->h_addrtype,host->h_length);

    /* Return the binary, network byte ordered address */
    return *((unsigned long *) host->h_addr_list[0]);
}
