cURL / Mailing Lists / curl-library / Single Mail

curl-library

How to use port mode to transfer file

From: zhang lei <zhanglei901_at_gmail.com>
Date: Thu, 30 Mar 2006 23:38:43 +0800

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