curl-library
ftp persistant connection
Date: Mon, 30 Oct 2006 11:48:10 +0800
I wrote a ftp client application which send NLST to server every 1s. Here is ftp server log:
(000011) 2006-10-30 11:39:55 - zhou (127.0.0.1)> PASV
(000011) 2006-10-30 11:39:55 - zhou (127.0.0.1)> 227 Entering Passive Mode (127,0,0,1,18,211)
(000011) 2006-10-30 11:39:55 - zhou (127.0.0.1)> TYPE A
(000011) 2006-10-30 11:39:55 - zhou (127.0.0.1)> 200 Type set to A
(000011) 2006-10-30 11:39:55 - zhou (127.0.0.1)> NLST
(000011) 2006-10-30 11:39:55 - zhou (127.0.0.1)> 150 Connection accepted
(000011) 2006-10-30 11:39:55 - zhou (127.0.0.1)> 226 Transfer OK
It seems that the PASV command is also sent and connection is re-established every time. What's wrong with it? My source code is like the following:
CURL *curl = curl_easy_init();
if ( curl )
{
while ( isRunning )
{
// send NLST
list(curl);
// download
download(curl);
// sleep 1 second
sleep(1000);
}
}
curl_easy_cleanup(curl);
The libcurl document say it will try to keep the connection keep-alive / persistent when you use the same CURL. But why it'll reconnect every time when I send NLST command in my case?
Thanks
Received on 2006-10-30