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: How to check if machine has network connectivity using libcurl api reliably?

From: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 22 Nov 2022 10:23:51 +0100 (CET)

On Tue, 22 Nov 2022, Dipak B via curl-library wrote:

> How can an Windows application integrated with libcurl find out reliably
> and quickly if the machine has any kind of network connectivity?
>
> Further there can be situations were Wifi network is available but Internet
> connection / link is not working.
>
> In such a situation how does one find if Internet connection is available
> using libcurl?

If you by "network connectivity" mean "connectivity to a known HTTP server you
have reasonable expectations to exist and respond", then you can just do a
HEAD request to that server with a reasonably short timeout and check that it
succeeds.

If you want to check something more fine-grained than so, then maybe libcurl
is not the right answer for you. libcurl is a transfer library, not a network
connectivity check library.

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://curl.se/support.html
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2022-11-22