cURL / Mailing Lists / curl-library / Single Mail

curl-library

FTP upload issue

From: Carlos Rimola <crimola_at_gmail.com>
Date: Tue, 1 Nov 2016 18:37:36 -0700

Hello All,

I am a relative newbie to libcurl and I hope someone can help me with an
issue I am having performing FTP uploads. First, some background:

1) I need to use the multi-interface.

2) I started with the ftpupload.c example. I modified it to add mcurl_init,
add the easy_handle, etc. That all works fine. I called that ftpuploadm.c.
It's pretty much ftpupload.c with minor "multi" modifications.

3) The data I need to upload I have no control over and is part of large
embedded system. The data comes to me via a "channel" in 256 byte chunks.
Therefore the parameter I pass to my read_callback is not a file descriptor.

4) I have tried passing the data pointer and length in a data structure up
to the read_callback. I have also tried reading the "channel" within the
callback.

The problem I see is that data on the channel is always ready (available)
and the first 10 times I call curl_multi_perform. My read_callback is not
invoked.

I turned the VERBOSE option on and I can see what is going but have tried a
number of things and I can't avoid the condition.

What VERBOSE shows is that during those first 10 calls to
curl_multi_perform, the FTP control socket connection is being established
(I assume the data socket as well). It is only when it reaches its end (I
see " < 150 Ok to send data" that my callback is then called consistently
and successfully on each call to curl_multi_perform. However, I end up with
a transfer that is 2560 bytes short (256 x 10).

Is there any way to establish the control and data connections and know
they are established so that calling curl_multi_perform will invoke my
read_callback (when the connection is established, logged in and all is
ready)?

I hope I have explained the issue well enough.

Thanks in advance for any help and insights!

Carlos

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-11-02