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

int main() {
    struct hostent result;
    struct hostent* result_ptr = &result;
    struct in_addr in;
    char* addr = "74.125.19.103";
    char buffer[500];
    int error;

    in.s_addr = inet_addr(addr);
    gethostbyaddr_r((char*)&in,sizeof(in),AF_INET,
      &result, buffer, 500, &result_ptr ,&error);

    printf("%s\n",result.h_name); 
    printf("%d\n",result.h_length);
    printf("%u\n",result.h_addr_list[0]);
}
