描述:
URLcode res;
curl_easy_setopt(_curl, CURLOPT_URL, _packageUrl.c_str());
curl_easy_setopt(_curl, CURLOPT_WRITEFUNCTION, downLoadPackage);
curl_easy_setopt(_curl, CURLOPT_WRITEDATA, fp);
curl_easy_setopt(_curl, CURLOPT_NOPROGRESS, false);
curl_easy_setopt(_curl, CURLOPT_PROGRESSFUNCTION, assetsManagerProgressFunc2);
curl_easy_setopt(_curl, CURLOPT_PROGRESSDATA, this);
curl_easy_setopt(_curl, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt(_curl, CURLOPT_LOW_SPEED_LIMIT, LOW_SPEED_LIMIT);
curl_easy_setopt(_curl, CURLOPT_LOW_SPEED_TIME, LOW_SPEED_TIME);
curl_easy_setopt(_curl, CURLOPT_FOLLOWLOCATION, 1 );
返回: CURLE_COULDNT_CONNECT(7) connect()的主机或代理失败。
IPV4网络环境正常下载
IPV6网络环境返回 CURLE_COULDNT_CONNECT(7) , 但使用浏览器是能打印这个链接地址的。
解决方案1:
你使用的库 libcurl 不支持IPV6,你要去下载或者自己编译一个支持IPV6的libcurl 在编译的时候加上:--enable-ipv6