cURL / Mailing Lists / curl-library / Single Mail

curl-library

Question about curl timers

From: Carlo Wood <carlo_at_alinoe.com>
Date: Tue, 25 Sep 2012 16:31:20 +0200

Hello,

is it possible to change ,
CURLOPT_LOW_SPEED_TIME, CURLOPT_CONNECTTIMEOUT and while a
transaction is in progress, ie from the read- or write callback?

I'm trying to solve the following problem:

- DNS look ups might take a minute or whatever, but only
  the first time we connect to a host; for the next
  connection I set the times a lot lower.
- The connection should be established within a relative
  short period, or I consider the host unreachable or down etc.
- A POST can be sent rather quickly.
- Next it takes a long time for the server to reply,
  lets say - up to a minute easily,
- but once the data starts to come in, I want to disconnect
  as soon as possible when I see that the download speed is too slow.

The last step requires demanding some download speed
with a CURLOPT_LOW_SPEED_TIME of 10 seconds say.
But doing that before I start the transaction causes it
to time out on the second last step.

So, I wish to use CURLOPT_CONNECTTIMEOUT to monitor
step 2, then set CURL_TIMEOUT to 1 minute after
doing my POST, and once I start to receive data,
I wish to set CURL_TIMEOUT to -say- 10 minutes,
and set CURLOPT_LOW_SPEED_LIMIT and CURLOPT_LOW_SPEED_TIME
to start monitoring the download speed.

Can someone please kindly tell me if this is possible,
and if so what caveats there might be.

-- 
Carlo Wood <carlo_at_alinoe.com>
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-09-25