curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Create Serverside Streaming connection using libcurl

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Mon, 1 Apr 2019 02:40:41 -0400

On 3/30/2019 4:59 AM, Prashant Shubham via curl-library wrote:
> On 3/30/19, Daniel Stenberg <daniel_at_haxx.se> wrote:
>> On Thu, 7 Mar 2019, Prashant Shubham via curl-library wrote:
>>
>>> I have gone through libcurl but couldn't find a clear implementation of
>>> streaming connection except rtsp one.
>> I would say the opposite and claim that libcurl supports streaming of
>> virtually all protocols. At least the TCP based ones. libcurl will sit and
>> wait for data until data arrives and then it delivers it. Over and over
>> until
>> the end of connection (which might neve occur).
>>
>> --
>>
>> / daniel.haxx.se
>>
> Hi Daniel,
> It would be great help if you could point to some examples.

If you are parsing messages from a stream in real time you'll have to
store the received bytes so that you can accumulate enough bytes to
parse a message. There's no guarantee that your write callback will
receive all the bytes you expect in one call. For example
https://gist.github.com/jay/f355d98e87fde19b1455b0b31dd118fd

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-04-01