/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
/* a sample program that gets the ftp/tcp port number. */
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>

int main() {
    struct hostent *host;
    char *addr = "tiger.engr.ucdavis.edu";
    struct in_addr in;

    host = gethostbyaddr(addr,sizeof(addr),AF_INET);
    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)); 
}
