Reputation: 2018
I have a program, which works with sockets. On the client side I get neccessary info via getaddrinfo, and after that the results are passed to connect function. Thing is, it works diferently on different environments. On some envs after obtaining addrinfo structure and passing it to connect function I get invalid argument error. Am I missing something? Please, help me with that. I am using it like this:
getaddrinfo(host, NULL, NULL, &Result);
Passing hints argument with set socket type and socket family did not bring me any result.
Thanks on advance.
Upvotes: 0
Views: 107
Reputation: 123260
Just a guess, because there is no code from you to check: Please make sure, that the domain of the socket (AF_INET or AF_INET6) matches the domain of the ai_family from the addrinfo structure. Better yet, create the socket after the getaddrinfo call and use ai_family as the sockets domain.
Upvotes: 1