Rewrite examples - conservative server /* have cmd line option to change this */ int af = AF_INET6; struct addrinfo hints, *res; int s, i; memset(&hints, 0, sizeof(hints)); hints.ai_family = af; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; error = getaddrinfo(NULL, "http", &hints, &res); if (error) exit(1); if (res->ai_next) { fprintf(stderr, "multiple addr"); exit(1); } /* res has chain of wildcard addrs */ s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); if (s < 0) exit(1); if (bind(s, res->ai_addr, res->ai_addrlen) < 0) exit(1); listen(s, 5); freeaddrinfo(res);