wwHTTP::HttpPing

Use this method to ping a Web site to check whether a valid Internet connection can be made.

You provide a fully qualified URL - preferably a static page that loads fast - to check, and you can specify a timeout value that determines how long this request runs and waits a response.

If a non-error response is returned the method returns .T. If the request times out, or a server error occurs the function returns .F.

o.HTTPPing(lnTimeout,lcUrl)

Return Value

.T. or .F. On error cErrorMsg is set with an error number string.

Parameters

lnTimeout
Timeout in seconds.

Timeouts are not exact and especially for connection issues where an IP Address/DNS Name exists but a server is not responding the initial connect timeout may be longer than the minimum time specified. In typical testing you can expect a minimum timeout of ~4 seconds for physical connection failures.

lcUrl
A fully qualified URL that you want to check.

Examples: https://west-wind.com https://webconnection.west-wind.com/download.aspx

lcServer and lcLink
For backwards compatibility the lcUrl and lcLink parameters can be used to pass a server name and server relative page path.

Example (not recommended): Http.HttpPing(5,"webconnection.west-wind.com","/download.aspx")

Remarks

This routine is not a classic PING like operation, but it works only over the HTTP protocol.

Example

oIP = CREATEOBJECT("wwHttp")

*** Optionally - set any oIP Connection options
oIP.cUsername = "ricks"
oIP.cPassword = "supersecret"

IF !oIP.HTTPPing(5,"https://west-wind.com/somepage.htm")
   MessageBox("No Connection")
   RETURN
ENDIF

See also:

West Wind Web Connection

© West Wind Technologies, 2021 • Updated: 04/05/21
Comment or report problem with topic