A timeout setting for curl in the embedded system FTP download

Source: Internet
Author: User
Reprinted please indicate the source and the author contact: http://blog.csdn.net/mimepp
Contact information: Yu Tao <yut616 at Sohu dot com>

A timeout issue in the FTP download process of curl has recently been involved. Record it here.

Curl is a good open source for network transmission. It implements a large number of connection methods, such as FTP, ftps, HTTP, https, SCP, SFTP, TFTP, telnet, dict, LDAP, LDAPS, file.
For details, refer to: http://curl.haxx.se/

In the embedded system, the firmware upgrade of FTP is involved, and the curl operation is added to the thread.
Mainly involved
Curl_easy_init
Curl_easy_setopt, cursor, curlopt_url, curlopt_connecttimeout, curlopt_timeout, cursor, cursor, curlopt_writedata, curlopt_noprogress, curlopt_progressfunction, curlopt_verbose, comment
Curl_easy_perform
Curl_easy_cleanup

If an exception occurs during the connection, such as network disconnection, you need to handle curlopt_connecttimeout and return curle_couldnt_connect.
If the connection is established during the download process and an exception occurs later, such as network cable disconnection, you need to handle curlopt_timeout and return curle_operation_timeouted.
In the above two cases, you can handle exceptions and prompt some information to meet your needs.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.