0

I'm sending files from linux server to windows remote system using libcurl FTP.

Below is the code

curl_easy_setopt(CurlSessionHandle, CURLOPT_URL, remoteFileUrl);
curl_easy_setopt(CurlSessionHandle, CURLOPT_UPLOAD, ON);

// Set the input local file handle
curl_easy_setopt(CurlSessionHandle, CURLOPT_READDATA, localFileHandle);

// Set on/off all wanted options
// Enable ftp data connection
curl_easy_setopt(CurlSessionHandle, CURLOPT_NOBODY, OFF);

// Create missing directory into FTP path
curl_easy_setopt(CurlSessionHandle, CURLOPT_FTP_CREATE_MISSING_DIRS , ON) ;

// Set the progress function, in order to check the stop transfer request
curl_easy_setopt(CurlSessionHandle, CURLOPT_NOPROGRESS, OFF);
curl_easy_setopt(CurlSessionHandle, CURLOPT_PROGRESSFUNCTION, progressCb);
curl_easy_setopt(CurlSessionHandle, CURLOPT_PROGRESSDATA, this);

CURLcode Result = curl_easy_perform(CurlSessionHandle);

====================================================================

few files are not transferred to remote but i didn't receive any error from curl_easy_perform(). This is happening randomly.

I have collected the wireshark logs, trace shows [RST, ACK] was sent from our side to remote system don't know the reason and response code 226 was sent from remote system, i think i should receive some error code from curl_easy_perform() instead of CURLE_OK. Please correct me if i'm wrong.

Please check the image which has wireshark traces.

Source IP: 82 is Linux server & Destination IP: 87 is Windows remote system

enter image description here

I would like to know why we are sending [RST, ACK] to remote and why libcurl is not returning error code. Can someone explain to me is there a way to handle this problem.

I have uploaded images of success and failure case. Please check and let me know enter image description here

Failure case, Check the response argenter image description here

rohit
  • 65
  • 10
  • Extracted from [wikipedia](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes). 226 IM Used (RFC 3229) `The server has fulfilled a request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.` So It isn't an error at all, Only It is notifying the operation is fullfiled. And It is not random also. – JTejedor Jul 28 '17 at 08:44
  • Are these two handlers the same ? Otherwise you have a bug here: ```curl_easy_setopt(CurlSessionHandle, CURLOPT_URL, remoteFileUrl); curl_easy_setopt(m_CurlSessionHandle, CURLOPT_UPLOAD, ON);``` – Bogolt Jul 28 '17 at 09:27
  • I have added new images for reference, Please have a look. – rohit Jul 28 '17 at 10:17
  • @JTejedor1: Hi JTejedor1, thank you for the clarification on 226 response code. I have a question regarding the response arg, in Success case it is "File Successfully Transferred" and in Failure case it is "Error during read from data connection". I would like to know is there any significance of response arg. – rohit Jul 28 '17 at 10:47
  • @rohit: Hi! My mistake! Sorry, I do not see the rest of images. Maybe you could retrieve the HTTP code and capture the description using something like [this](https://stackoverflow.com/questions/290996/http-status-code-with-libcurl). – JTejedor Jul 28 '17 at 11:25
  • @JTejedor: Hi, I would like to know what value it returns if i use CURLINFO_SIZE_UPLOAD in failure case. – rohit Aug 04 '17 at 13:09

0 Answers0