cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to separate two different response

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 17 May 2016 14:16:28 -0400

On 5/17/2016 3:20 AM, smruti kumari wrote:
>
> I am sending a http request and adding josn data in the body.Similary
> server also responding with json body.The response packet we will recv
> in the write callback.But my query is
>
> How can we come to know that how much bytes I need to receive for the
> particualr response ?

Can you be more specific? The write function is passed as much data as
available when it's called [1]. It will likely be called multiple times,
each time with a piece of the reply. It's up to your callback to append
those pieces. Take a look at the getinmemory example [2]. When you say
server response packet what do you mean? Do you mean you have received
two server replies or your write callback has been called twice? Those
are two different things.

[1]: https://curl.haxx.se/libcurl/c/CURLOPT_WRITEFUNCTION.html
[2]: https://curl.haxx.se/libcurl/c/getinmemory.html

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-05-17