문제

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;
}

this gives the error: "ai_socktype not supported" if i comment out the hint.ai_protocol = AI_PASSIVE; it will get through, but i am wondering why it happens?

thanks for your time

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top