cURL / Mailing Lists / curl-library / Single Mail


Re: FTP keep alive connection

From: Michel Loiseleur <>
Date: Thu, 8 Nov 2007 12:20:40 +0100

Le Monday 05 November 2007 18:16:15 Michel Loiseleur, vous avez écrit :
> Hi all,
> After my post here :
> I have reworked a little the patch, according to the comment. Feel free
> to improve it, hack it and especially, integrate it :).
> In one sentence, this patch add a small feature to curl during ftp
> transfer : it sends "NOOP" message in order to keep connection alive.
      Here's some news. As stated with some of you on this list, the "NOOP"
approach is really dangerous and cannot be applied in all cases, with all
      To the contrary, the SO_KEEPALIVE approach is working well. The patch is
nonintrusive and do not force us to add some more flags or more options on
compile time.
     It was validated on the whole set of my use cases. See the patch attached
for a sample code. It's maybe not the good place to set it, since I cannot
put the error message on the common log. But I do not know if it's better to
get the logger in the function or to set this socket option elsewhere, where
the logger is. So I'll leave it to one of the maintener.

     Here is the sysctl call :
$ sudo sysctl -w sysctl -w net.ipv4.tcp_keepalive_time=x
   With the small patch attached and x=60 for the sysctl call, we do not
encounter any more lost connection during long transfer.

    Feel free to integrate it (and keep me informed if it's the case ;)).


Loiseleur Michel / SLL
Groupe Linagora
27, rue de Berri / 75008 PARIS
Tel/Fax : 01 58 18 68 28 / 01 58 18 68 29
"Ce n'est pas le logiciel qui est libre, c'est vous"

Received on 2007-11-08