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.