Server rewrite - After the rewrite struct addrinfo hints, *res, *res0; int s, i, on = 1; memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; error = getaddrinfo(NULL, "http", &hints, &res0); if (error) { fprintf(stderr, "%s", gai_strerror(error)); exit(1); } /* res0 has chain of wildcard addrs */