curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Detection of failed connection

From: Ray Satiro via curl-library <curl-library_at_lists.haxx.se>
Date: Wed, 3 Jan 2024 03:32:08 -0500

On 1/3/2024 3:17 AM, Ali Nasir via curl-library wrote:
> I am trying to upload a file to an end point using multi interface.
> Example code used is https://curl.se/libcurl/c/postit2.html
> However, i see that when the server is down, there is no error
> reported from any of the curl interfaces.
>
> If i perform the same operation via the curl command from the shell, i
> get the returnĀ code as 7. But all the multi interfaces like info_read
> and mulit_perform return CURLE_OK.
> CanĀ  anyone guide how to detect failures with libcurl. Specially when
> the server is down.


That example uses curl_easy_perform not curl_multi_perform so there must
be some changes that you made. curl_multi_info_read should return the
transfer result code (CURLcode) in data.result. [1][2]

Also you could enable verbose mode to see if that's how the transfer is
actually failing. [3]

[1]: https://curl.se/libcurl/c/curl_multi_info_read.html
[2]: https://curl.se/libcurl/c/libcurl-errors.html
[3]: https://curl.se/libcurl/c/CURLOPT_VERBOSE.html



-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2024-01-03