cURL / Mailing Lists / curl-library / Single Mail


Réf. : How to use port mode to transfer file

From: Philippe HAMEAU <>
Date: Thu, 30 Mar 2006 18:55:12 +0200

First off : are you behind a NATing routeur ?

"zhang lei" <>

Envoyé par :
30/03/2006 17:38
Veuillez répondre à libcurl development
Remis le : 30/03/2006 17:49

        Pour :
        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
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