Question

struct addrinfo *myAddrinfo, *curMyAddrinfo, hint;
memset(&hint, 0, sizeof(struct addrinfo));
hint.ai_family = AF_INET;
hint.ai_protocol = AI_PASSIVE;
hint.ai_socktype = SOCK_STREAM;

const int code = getaddrinfo(NULL, SERVER_PORT, &hint, &myAddrinfo);
if ((code) != 0) {
    printf("getaddrinfo error occours: %s ",
            gai_strerror(code));
    return 1;
}

Cela donne l'erreur: "AI_SOCKTYPE non pris en charge" si je commençais le hint.ai_protocol = AI_PASSIVE; Cela passera, mais je me demande pourquoi cela se produit?

Merci pour votre temps

Pas de solution correcte

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top