Languages

Menu
Sites
Language
CURL 관련 문제
void send_data() {
   CURL *curl;
   CURLcode res;
   char buff[60];
url_global_init(CURL_GLOBAL_ALL);
   curl = curl_easy_init();
   if(curl) {
  curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
  curl_easy_setopt(curl, CURLOPT_URL, url);
  curl_easy_setopt(curl, CURLOPT_POST, 1);
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS,buff);
  res = curl_easy_perform(curl);
  long statLong;
  curl_easy_getinfo(curl, CURLINFO_HTTP_CODE, &statLong);
  dlog_print(DLOG_ERROR, "test",statLong);
 
    //  Perform the request, res will get the return code
     // Check for errors
     //if(res != CURLE_OK){
    // dlog_print(DLOG_ERROR, "test", "CurlFail", res);
      //elm_exit();
     //}
     // always cleanup
  curl_easy_cleanup(curl);
  curl_global_cleanup() ;
   }
이 코드를 작성하였습니다
buff = post 형식 데이터
 
이 코드를 실행시키면 앱이 작동을 멈춥니다 
한번은 전송이 됩니다. 하지만 두번째는 작동 하지 않고 보내는 이후에 앱이 작동을 멈춥니다 
 
이 함수는 센서 데이터 콜백이 불릴때 콜백 함수에서 콜하게 됩니다 
문제점이 뭘까요 

Responses

6 Replies
Shaswati Saha

So far I could understand from your post is that, you're facing app crash using the code in your post. In this purpose, you may try following this link. I'm not getting any curl error or app crash by using the code in that link. 
Also please check if you've added the following privileges:

<privilege>http://tizen.org/privilege/network.get</privilege>
<privilege>http://tizen.org/privilege/network.set</privilege>
<privilege>http://tizen.org/privilege/internet</privilege>

Moreover, please check the values url and buff containing by using dlog_print(). Provide correct URL and POSTFIELDS.

Cho

add this previlege 

 

in server it can get data 

in the log i can see app_dead_handler 

 

sprintf(buff,"gyrox=%f&gyroy=%f&gyroz=%f&hrm=%f",gyroX,gyroY,gyroZ,heartR);

Shaswati Saha

"in server it can get data" what do you mean by this line? Now the server is getting data through the POST method?

Cho

i send to server php and store in database

this process is works but only once 

 

my intenstion is 

get sensor data-> send server -> getsensor data -> ...

 

but now 

get sensor data-> send server -> app_dead_handler 

GEUNSOO KIM

did you check if there is any crash report on tizen studio?

it sounds like the program has crashed after sending first try.

Reyes Veum

I checked my mail and admitted it sent me a crash report but I didn't notice with the name mr mine. But the report said that my version couldn't do or fix anything.