cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Info request about the zero copy interface (2)

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 5 Dec 2005 11:01:11 +0100 (CET)

On Sun, 4 Dec 2005, Legolas wrote:

> I am very rusty in socket programming, I suppose you have the following
> scenario when handling incoming data from the socket layer:
>
> - you have knowledge of a certain amount of pending data available to be
> read through a function like 'recv'

That is not the case.

We know there is data available to read (but we cannot know how much). We must
already have a known buffer area to store data in, then call recv() to get the
data and then store it in the buffer (possibly after some "decoding" like SSL,
chunked HTTP and similar).

Therefore, we must already have been given a buffer pointer (and size) from
the application layer where we can store the received data BEFORE we call the
write callback.

Without that, we cannot do zero copy. Unless I'm forgetting something.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-12-05