curl-library
curl_easy_perform() call does not return
From: Pradeep <s.pradeep_at_teles.com>
Date: Tue, 13 Nov 2007 21:48:39 +0530
Hi All,
I'm facing a problem with libcurl version 7.15.4 on Suse linux 9.1. My multithreaded cpp program uses libcurl to download files once a day from the FTP server. Program is running from past 5 months. After 79 days it has stopped downloading files from the FTP server, since then netstat command always shows the below entry:
Local Address Foreign Address State PID/Program name
192.168.110.185:33313 192.168.110.125:21 ESTABLISHED 15668/MyProgram
but FTP server has no such client. The program tried to connect to the FTP server on the 80th day. The FTP server logs show a successful connection on the 79th day and no connection from my program since then.
Following is the function which has not returned:
int FTPAccess::DownloadFile(char* RemoteFilename, char* LocalFilename)
{
CURLcode iReturnCode; int iReturnValue = 0;
FILE *fLocalStream = fopen(LocalFilename, "wb");
if(fLocalStream == NULL)
{
return -1;
}
curl_easy_setopt(m_pcCurl, CURLOPT_URL, RemoteFilename);
curl_easy_setopt(m_pcCurl, CURLOPT_WRITEDATA, fLocalStream);
if(UserName.length() != 0 && Password.length() != 0)
{
string AuthenticationString = UserName + ":" + Password;
curl_easy_setopt(m_pcCurl, CURLOPT_USERPWD, AuthenticationString.c_str());
}
iReturnCode = curl_easy_perform(m_pcCurl);
if(CURLE_OK != iReturnCode)
{
iReturnValue = -1;
std::cout<<"Error in downloading file [%s]"<<RemoteFilename;
}
if(fLocalStream != NULL)
{
fclose(fLocalStream);
}
curl_easy_reset(m_pcCurl);
return iReturnValue;
}
Also m_pcCurl = curl_easy_init() is done only during the program startup.
Please look into the above code fragment and let me know any mistakes in it. I'm sure that one of the libcurl APIs in the above function has not returned. I have seen the latest Changelog, but did not find any fix for this. Can someone please help me fix the problem?
Thanks,
Pradeep
Received on 2007-11-13
Date: Tue, 13 Nov 2007 21:48:39 +0530
I'm facing a problem with libcurl version 7.15.4 on Suse linux 9.1. My multithreaded cpp program uses libcurl to download files once a day from the FTP server. Program is running from past 5 months. After 79 days it has stopped downloading files from the FTP server, since then netstat command always shows the below entry:
Local Address Foreign Address State PID/Program name
192.168.110.185:33313 192.168.110.125:21 ESTABLISHED 15668/MyProgram
but FTP server has no such client. The program tried to connect to the FTP server on the 80th day. The FTP server logs show a successful connection on the 79th day and no connection from my program since then.
Following is the function which has not returned:
int FTPAccess::DownloadFile(char* RemoteFilename, char* LocalFilename)
{
CURLcode iReturnCode; int iReturnValue = 0;
FILE *fLocalStream = fopen(LocalFilename, "wb");
if(fLocalStream == NULL)
{
return -1;
}
curl_easy_setopt(m_pcCurl, CURLOPT_URL, RemoteFilename);
curl_easy_setopt(m_pcCurl, CURLOPT_WRITEDATA, fLocalStream);
if(UserName.length() != 0 && Password.length() != 0)
{
string AuthenticationString = UserName + ":" + Password;
curl_easy_setopt(m_pcCurl, CURLOPT_USERPWD, AuthenticationString.c_str());
}
iReturnCode = curl_easy_perform(m_pcCurl);
if(CURLE_OK != iReturnCode)
{
iReturnValue = -1;
std::cout<<"Error in downloading file [%s]"<<RemoteFilename;
}
if(fLocalStream != NULL)
{
fclose(fLocalStream);
}
curl_easy_reset(m_pcCurl);
return iReturnValue;
}
Also m_pcCurl = curl_easy_init() is done only during the program startup.
Please look into the above code fragment and let me know any mistakes in it. I'm sure that one of the libcurl APIs in the above function has not returned. I have seen the latest Changelog, but did not find any fix for this. Can someone please help me fix the problem?
Thanks,
Pradeep
Received on 2007-11-13