/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/* a sample program that prints the name of host. */
#include <stdlib.h>
#include <stdio.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>

int main() {
    struct hostent *host;
    char * servername = "www.whitehouse.gov";
    struct in_addr in;

    host = gethostbyname(servername);
    printf("%s\n",host->h_name); 
    printf("%d\n",host->h_length);
    printf("%u\n",host->h_addr_list[0]);
    in.s_addr = *(u_long *) host->h_addr_list[0];
    printf("%s\n",inet_ntoa(in));
}
