cURL / Mailing Lists / curl-library / Single Mail


Re[4]: Working with curl connections as with sockets.

From: Tetetest <>
Date: Sat, 3 May 2008 12:44:42 +0400

Hello Daniel,

Saturday, May 3, 2008, 12:47:47 AM, you wrote:

DS> Two things:

DS> #1 - These functions never return anything that hint the caller of them that
DS> they return since they would otherwise block. It will force applications
DS> to guess when they should just wait for the socket to become ready, or
DS> when to bail out.

The caller should *always* wait on the socket to become ready (and it
must be mentioned in the docs, so I will update the man pages).

Take curl_easy_send() for example:

1. The application obtains the socket and calls select() to make sure
   it can safely send data.
2. If then curl_easy_send() reports *any* error, we are sure it was
   not due to EWOULDBLOCK.

The same paradigm should (must) be used with curl_easy_recv(). Yes, it
does force the application to use a specific sequence of operations,
but I think that mentioning this peculiarity in the docs and giving an
example of usage is enough.

Anyway, these functions are fairly low-level, and we know that
low-level functions are usually harder to use.

DS> #2 - Less important: it doesn't use the standard 2 space indent levels, and it
DS> has a few lines > 80 columns.

Ooops. I will fix this.

Best regards,
Received on 2008-05-03