Hi!
I use AppWarpClient from this link.
But I think it does not support IPv6. Apple reject my next iOS app version due to their new policy.
I modify some code at socket connect according to Apple Link.
Here is my code:
int Socket::sockConnect(std::string host, short port)
{
struct addrinfo hints;
struct addrinfo *result, *rp;
int s;
/* Obtain address(es) matching host/port */
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET; /* Allow IPv4 or IPv6 */
hints.ai_socktype = SOCK_STREAM; /* stream socket */
hints.ai_flags = 0;
hints.ai_protocol = 0; /* Any protocol */
s = getaddrinfo(host.c_str(), to_string(port).c_str(), &hints, &result);
if (s != 0)
{
CCLOG("ConsoleUploadFile: getaddrinfo error");
return AppWarp::result_failure;
}
for (rp = result; rp != nullptr; rp = rp->ai_next) {
sockd = socket(rp->ai_family, rp->ai_socktype,
rp->ai_protocol);
if (sockd == -1)
continue;
if (connect(sockd, rp->ai_addr, rp->ai_addrlen) != -1)
break; /* Success */
close(sockd);
}
if (rp == nullptr) { /* No address succeeded */
return AppWarp::result_failure;
}
freeaddrinfo(result); /* No longer needed */
fcntl(sockd, F_SETFL, O_NONBLOCK);
return AppWarp::result_success;
}
Would you please help me fix this?
Thanks.