curl-library
Connect only
Date: Wed, 3 Dec 2008 15:39:59 +0100
Hello All,
I'm trying to setup an ftp connection using Libcurl 7.19.2.
What I want to do is a CURLOPT_CONNECT_ONLY in order to use the recv function.
My init :
curlResult = curl_global_init(CURL_GLOBAL_ALL);
//Create easy Curl object
m_curlFtpHandle = curl_easy_init();
//set curl Parameters if handle is valid
if(m_curlFtpHandle)
{
curl_easy_setopt(m_curlFtpHandle, CURLOPT_VERBOSE , 1);
curl_easy_setopt(m_curlFtpHandle, CURLOPT_STDERR, stdout);
//Set url
curlResult = curl_easy_setopt(m_curlFtpHandle, CURLOPT_URL, m_sUrl);
//Set username and password
curlResult = curl_easy_setopt(m_curlFtpHandle, CURLOPT_USERPWD, "user:pw");
curlResult = curl_easy_setopt(m_curlFtpHandle, CURLOPT_FTP_USE_EPSV, 1);
//Only connect
curlResult = curl_easy_setopt(m_curlFtpHandle, CURLOPT_CONNECT_ONLY, 1L);
}
else
{
//error
}
curlResult = curl_easy_setopt(m_curlFtpHandle, CURLOPT_RESUME_FROM,
m_uiStartPos);
curlResult = curl_easy_perform(m_curlFtpHandle);
if(curlResult != 0)
{
//error handling
}
I get a connection with my ftp server. But the easy_perform function
returns after 60 sec when a timeout has occurred.
I'm using an url -> ftp://192.168.1.1/x/y/z/movie.avi
output of libcurl:
* About to connect() to 192.168.8.160 port 21 (#0)
* Trying 192.168.8.160... * connected
* Connected to 192.168.8.160 (192.168.8.160) port 21 (#0)
< 220 "FTP"
> USER user
< 331 Please specify the password.
> PASS pw
< 230 Login successful.
> PWD
< 257 "/home/user"
* Entry path is '/home/user'
* Remembering we are in dir "x/y/z/140-8channel8.mpg"
* FTP response timeout
* control connection looks dead
* Closing connection #0
* Timeout was reached
Failed easy perform curl : 28
And now I don't understand why i cannot create a connect only
connection ? is it something in my code
or a setting in my ftp server or ...
Best regards,
Jacob
Received on 2008-12-03