Checks whether a network address can be reached by using the ICMP protocol (similar to the PING network utility).
IF Ping("www.mysite.com") = True THEN
Info("The server is available. You can see the News")
Info("Server temporarily unavailable")
<Result> = Ping(<Address> [, <Maximum duration>])
- True if the sought address is "visible" on the network,
- False otherwise. To get more details on the error, use ErrorInfo.
<Address>: Character string
Address for which the network connection must be checked. This IP address can have the following format:
- Address in XXX.XXX.XXX.XXX format (184.108.40.206 for example). This syntax is recommended.
- DNS address of the computer (www.windev.com for instance).
- Address returned by NetIPAddress
<Maximum duration>: Optional integer or optional Duration
Maximum duration allowed to find the address (in milliseconds). This parameter can correspond to:
This duration is set to 1000 by default.
- an integer corresponding to the number of milliseconds,
- a Duration variable,
- the duration in a readable format (e.g., 1 s or 10 ms).
function is essentially a network diagnostic tool. It does not guarantee that
- the computer will respond on a given port (to do so, use SocketConnect).
- the computer is broken. Indeed, if the ping service is stopped on the computer, this computer will stop responding while it is still operating properly.
- the maximum duration will be used to interrupt the function if a network exchange with the server is in progress. For example, the server at the specified address could be contacted and the exchange has already started, but there was no response within the given time. However, if the address cannot be resolved, Ping returns False immediately and does not wait until the maximum duration is elapsed. You can get more details on the error with ErrorInfo.
Business / UI classification: Business Logic