curl / Mailing Lists / curl-library / Single Mail


Re: Issue with WRITE_FUNCTION callback , multi socket interface.

From: Daniel Stenberg via curl-library <>
Date: Mon, 4 Mar 2019 08:07:06 +0100 (CET)

On Mon, 4 Mar 2019, Badari Prasad via curl-library wrote:

> Does libcurl provide any event to application like START_OF_READ when
> response is ready and END_OF_READ kind of event which I can make use of for
> an http connection ? or any other better solution to this kind of issue
> where multiple responses for a single http request is received by client.


The response that curl gets is TCP. TCP is just a stream of bytes and curl
reads bytes whenever there are any available on the network to read. There's
no way for curl to make any other distinction of what is being delivered.

If what comes over the TCP is multiple messages as you say, then you need to
parse the contents or otherwise send markers in that content to make your app
able to do the necessary separation.

Also remember that due to routing, package retransmits etc, what looked like
"gaps" between TCP segments from one end might not at all by any gaps in the
other end, and data that is sent back to back might end up arriving with time
between the packages.

Received on 2019-03-04