docs

Home All functions Categories

vuInternetCanReachUrl()

vuInternetCanReachUrl(Url *CSTRING, TimeoutMs LONG), LONG

Description

Tests whether a specific URL can be reached within a caller supplied timeout. The function opens a WinINet session using the current Windows Internet settings, then attempts to open the given URL.

This is useful for checking connectivity to a particular service endpoint, not just generic Internet access.

Parameters

Parameter Data Type Description
Url *CSTRING Fully qualified URL to test, for example https://www.example.com/.
TimeoutMs LONG Timeout in milliseconds for both connect and receive operations. If less than or equal to 0, a default value of 5000 ms is used.

Returns

A LONG value:

Example

TestInternetCanReachUrl  PROCEDURE

RetVal   LONG
Url      CSTRING(256)

  CODE
  Url = 'https://www.example.com/'

  RetVal = vuInternetCanReachUrl(Url,3000)

  IF (RetVal = 1)
    MESSAGE('URL reachable within timeout: ' & Url)
  ELSIF (RetVal = 0)
    MESSAGE('URL not reachable or timed out: ' & Url)
  ELSE
    MESSAGE('Parameter or API setup error when checking URL: ' & Url)
  END

Notes

Home All functions Categories