cURL / Mailing Lists / curl-library / Single Mail


curl-multi: Pausing download with connection open

From: Richard Atterer <>
Date: Thu, 15 Jul 2004 16:12:36 +0200


I'm writing a program which can perform several concurrent downloads.
Sometimes, I want to pause a download, but keep its TCP connection(s) open.

I tried to use curl_multi_remove/add_handle() to achieve this, but it
doesn't seem to work. After the curl_multi_add_handle(), libcurl 7.11.2
does not seem to like the re-added object, it tears down the connection and

  * Connection 0 seems to be dead!
  * Closing connection #0
  * About to connect() to ...

Somehow, SocketIsDead() in url.c decides that the connection is dead.
Apparently, no new packet of data has arrived since the last call to
curl_multi_perform(), so the select() in SocketIsDead() returns 0. :-/

Looking at the code, I'm also left wondering whether it is possible that
the open connection of the paused download will be "snatched away" by
another download that I start in the meantime. If this is the case, will a
new connection be opened when I resume the previously paused download?

Maybe the use of curl_multi_remove/add_handle() for pausing some downloads
of a curl-multi application should be documented in the manpages?

BTW, thanks for libcurl!


  __   _
  |_) /|  Richard Atterer     |  GnuPG key:
  | \/|  |  0x888354F7
Received on 2004-07-15