curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: A string issue that after received the http 204, the curl_formadd function seems couldn't work again

From: 杨俊 <yangjun9772_at_gmail.com>
Date: Wed, 18 Jan 2017 08:58:06 +0800

Hi ,
Thank you for your help.

> So what exactly does your program send and receive in that case?

The main code is just like this:
do{
    ...
    ...
     curl_send_audio_content
     curl_multi_add_handle(multi_handle, handles[EVENT_HANDLE]);
   ...
   ...
}while(1)

So the program send to the server:
curl_send_audio_cfg: user header +
//============josn================//
curl_formadd(&postFirst, &postLast,
CURLFORM_COPYNAME, "metadata", /* CURLFORM_PTRCONTENTS, pAlexaJSON, */
CURLFORM_COPYCONTENTS, strJSONout,
CURLFORM_CONTENTTYPE, "application/json; charset=UTF-8",
CURLFORM_END);
                                                        +
//=============Audio=================//
curl_formadd(&postFirst, &postLast,
CURLFORM_COPYNAME, "audio",
CURLFORM_STREAM, &micRing,
CURLFORM_CONTENTTYPE, "application/octet-stream", //"audio/L16; rate=16000;
channels=1",
CURLFORM_END);

The program send this message to the server, then the server may return 200
or 204.
If the program got the 200, at the next while(1), it could still send the
header+json+micRing.
If the program got the 204, at the next while(1), it seems just send the
header.
I can make sure that the program doesn't send the micRing.
Because I add a printf in the readFileFunc which would be callback for
micRing(If call the readFileFunc will alwasy printf, If didn't call no
printf).

I didn't know if my code is right.
but the result is just like this. :(
If you want more information, please tell me.

Thx

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-01-18