curl-library
Re: Advanced API?
Date: Thu, 18 Oct 2001 11:40:20 +0200 (CEST)
On Thu, 18 Oct 2001, Andrew Francis wrote:
> > We should write down the functions, document their expected behavior
> and we
> > could try writing some faked implementation of clients using it. Then
> it'll
> > be easier to implement the API. IMHO.
>
> I have an application which receives a stream of data in the form
> HEADER, DATA, HEADER, DATA... the header is a constant size, the size of
> the data is determined by information in the header.
>
> At the moment I have a callback function that does it's own buffering -
> if it's expecting n bytes, and there's
> less than that available, it takes what it can and buffers it. When it
> gets enough information, it hands the entire HEADER/DATA off to a
> separate function for processing.
>
> What I'd really like to see is the ability to handle this "I want to
> wait until I have this much data available" behaviour with curl. Maybe
> something like the following:
>
> curl_connect(cp);
> expecting_data = MY_HEADER_SIZE;
> while(expecting_data > 0) {
> int status = curl_wait_for_data(expecting_data);
you can pretty much simulate this with select() and tmp buf...
-Sterling
Received on 2001-10-18