版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Piao_Polar/article/details/44592609
目前游戏用curl下载取版本数据,下载资源包之类的。
偶尔会发现在curl返回6,即CURLE_COULDNT_RESOLVE_HOST的时候,程序会崩溃。
网上查了下,在curl调用前,调用
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
即可解决此问题
google关键词:
curl reslove host crash
参考链接
http://curl.haxx.se/mail/archive-2008-05/0081.html
http://stackoverflow.com/questions/13702408/curl-requests-in-pthread-crashes-after-completion-of-requesthttp://discuss.cocos2d-x.org/t/curl-crashes-when-the-dns-try-to-resolve-the-host-but-exceeds-the-timout-of-curl/5335