The tests/CurlTest project in cocos2d-x, I make some small change at CurlTest::ccTouchesEnded()
`CURL *curl;
CURLcode res;
curl = curl_easy_init();
if (curl)
{
//curl_easy_reset(m_pCurl);
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);
char msg[100];
if (res == 0)
{
CCMessageBox("Connect ok", "Socket");
}
else
{
sprintf(msg, "Connect error, code:%d", res);
CCMessageBox(msg, "Socket");
}
//m_Callback->OnConnect(res);
curl_easy_cleanup(curl);
}`
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!