curl-library
Réf. : How to use port mode to transfer file
Date: Thu, 30 Mar 2006 18:55:12 +0200
First off : are you behind a NATing routeur ?
"zhang lei" <zhanglei901_at_gmail.com>
Envoyé par : curl-library-bounces_at_cool.haxx.se
30/03/2006 17:38
Veuillez répondre à libcurl development
Remis le : 30/03/2006 17:49
Pour : curl-library_at_cool.haxx.se
cc : (ccc : Philippe HAMEAU/DRD/SAGEM)
Objet : How to use port mode to transfer file
I want to use port mode to get a file from a ftp server, but it failed. It
can connect to the server and send retr command, but then, it returns fail
or timeout.
I set the options as follows:
curl_easy_setopt(curl, CURLOPT_URL, url); //url:the file url
curl_easy_setopt(curl, CURLOPT_INTERFACE, dev); //dev: in my computer ,it
is ppp0
curl_easy_setopt(curl, CURLOPT_FTPPORT, dev) ; //dev: ppp0
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite); //my_fwrite: my
write function
curl_easy_setopt(curl, CURLOPT_FILE, &ftpfile);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
curl_easy_setopt(curl, CURLOPT_USERPWD, user);
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, my_progressget_func);
//my progressfunction
curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout); //timeout: I set it to
600
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1);
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, noresponse); //noresponse;
I set it to 30
res = curl_easy_perform(curl);
if I use passive mode, it success. the server support both passive and
port mode. I use the cuteftp through the same dial-up network getting the
file is OK.
I don't know if some of my options set error?or need more other options?
Received on 2006-03-30