The tests/CurlTest project in cocos2d-x, I make some small change at CurlTest::ccTouchesEnded()
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "192.168.0.99");
curl_easy_setopt(curl, CURLOPT_PORT, 9000);
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
//curl_easy_setopt(m_pCurl, CURLOPT_CONNECTTIMEOUT_MS, 5000);
res = curl_easy_perform(curl);
if (res == 0)
CCMessageBox("Connect ok", "Socket");
sprintf(msg, "Connect error, code:%d", res);
And i run it ok in the windows and android.
And i move CurlTest.cpp and CurlTest.h to my own project from HelloWorld,just add CurlTest layer to the HelloWorld scene,
And i got the right result in windows, there’s a messagebox “Connect ok”,
And i compile and run it in android, the strange problem come out,
It Connect faild, “Connect error, code:7”
The same code at tests/CurlTest run in android is ok
Why my own project connect failed, is there something need to config or difference between tests project with HelloWorld project?
I’m very head pain about this, please help me, thank you!