CURL 관련 문제

CURL 관련 문제

BY 17 Jul 2017 General Support
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 형식 데이터
 
이 코드를 실행시키면 앱이 작동을 멈춥니다 
한번은 전송이 됩니다. 하지만 두번째는 작동 하지 않고 보내는 이후에 앱이 작동을 멈춥니다 
 
이 함수는 센서 데이터 콜백이 불릴때 콜백 함수에서 콜하게 됩니다 
문제점이 뭘까요 
Written by