cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Stop of curl data transfer

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 30 Oct 2007 10:33:22 +0100 (CET)

On Tue, 30 Oct 2007, Aaron shi wrote:

> 1) Possible reason of transfer stop?

libcurl returns error codes and error messages that help pinpoint the reason
to failures.

> I am working on the mips embedded system which using libcurl to transfer
> photo data with server(http protocol).
>
> Because I want to know the progress of transfer,so I use progress_callback
> as follow:
>
> Sometime I found the progress stopped,like 10% ..., it always be that
> percentage. I know that is becase no reponse data form server. May be the
> physical network is disconnect.

If the transfer stops before it is completed, it stopped because the TCP layer
report and error back to libcurl and then it stopped. I believe you are the
one here to identify what possible reasons there might be in your case.

> My platform using WIFI and DHCP to connnect with network. I search the web
> and see somebody say it's unstable of wifi dhcp connection.

What "it's" are you talking about? I can tell you with 100% certainty that
libcurl is indeed not unstable with wifi + dhcp in any combination, nor does
it even know nor care that wifi or dhcp is in use.

> Is there another possible reason?

There are probably thousands of possible reasons, and while of course there
might be a libcurl bug I consider that one of the less likely reasons for you
and the likelyhood of a bad network, bad hardware, bad server or similar much
more likely.

> 2)How to solve this problem?

1. Figure out why fails
2. Fix the failures
3. Smile!

Of course analyzing the network in detail when the problem appears is one of
the first things you should do to understand this better.

> I don't know how to handle this prolbem, the curl wait there for the server
> continuing response data...

If it just waits for data I would say in indicates that there's no data
coming...

> I try to use timeout option to solve this problem:
>
> long curl_timeout = GALLERY_CURL_TIMOUT_MINUTE*15;
> res = curl_easy_setopt(curl, CURLOPT_TIMEOUT,curl_timeout);

That's not a solution, that's a work-around that prevents the operation from
taking more than 15 minutes.

> For some reason I disable the SIGNAL using:
> res = curl_easy_setopt(curl, CURLOPT_NOSIGNAL,1);

That "for some reason" is documented.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-10-30