On 22-Nov-22 04:23, Daniel Stenberg via curl-library wrote:
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.

To follow-up on my earlier note:  an example.

This webpage describes are the hoops that Microsoft Windows jumps through to satisfy its definition of "connectivity".  Note the complications of proxy servers, WiFi authentication portals, and firewalls - even when there is a dedicated server for testing connectivity.  Also, as previously noted, all you get from this is an answer about http.  If you care about e-mail, or ftp, or vpn, or ... this isn't complete.

https://learn.microsoft.com/en-us/troubleshoot/windows-client/networking/internet-explorer-edge-open-connect-corporate-public-network

Of course, it's unlikely to be an accident that the Microsoft probes often redirect you to MSN if a portal is encountered....

David's reply gave a different definition of "connectivity". Whether it's better or worse depends on the application.

Sometimes an approximation is "good enough", but that's situation/application dependent.

As we both said, the only way to know for sure is to try the protocol and transaction that you actually require, and handle any failures.


Timothe Litt
ACM Distinguished Engineer
--------------------------
This communication may not represent the ACM or my employer's views,
if any, on the matters discussed.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

Reply via email to