#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <string.h>
#include <stdio.h>

int main(int argc, char **argv)
{

	struct addrinfo hints;
	struct addrinfo * res;
	int error;

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = AF_INET6;
	hints.ai_flags = AI_PASSIVE;
	hints.ai_socktype = SOCK_STREAM;

	if ((error = getaddrinfo(NULL, "80", &hints, &res)) < 0)
	{
		fprintf(stderr, "%s: error in getaddrinfo: %s\n", argv[0], gai_strerror(error));
		exit(1);
	}

	printf("sizeof(struct sockaddr_in6) = %d\n", sizeof(struct sockaddr_in6));
	printf("addrinfo->ai_addrlen        = %d\n", res->ai_addrlen);
	
	return 0;
}

