cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: reply to all: CURLE_OPERATION_TIMEDOUT when FTP upload withlarge files

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 4 Jun 2009 18:36:35 +0200 (CEST)

On Thu, 4 Jun 2009, A-ZYSTEMS wrote:

> I have read the tutorial and found the reason for SO_KEEPALIVE option
> (denial-of-service attack)

Surely SO_KEEPALIVE has very little to do with DOS attacks?

> curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
>
> And here the callback function:
>
> size_t CThreadUpload::sockopt_callback(void *clientp, curl_socket_t curlfd,
> curlsocktype purpose)
> {
> return 0;
> }

You can't make the callback to be a non-static C++ class member since the
callback from libcurl is plain C.

> But how can I set the SO_KEEPALIVE option in the callback.
>
> I found no example or description in the docs and google.

setsockopt and SO_KEEPALIVE should be two fine keywords to search for.

And curl uses this to do exactly this, so the src/main.c file is a good place
to check out too.

-- 
  / daniel.haxx.se
Received on 2009-06-04