At times you might build a customization in the SalesLogix LAN client that relies on networked resources. For example, you might consume a web service or other resource that is available to LAN users and remote users via VPN. In this scenario, and many others like it, you have the potential to have remote users that do not currently have access to this networked resource. Even worse, you might have remote users that may not even be online at the time. A quick PING can check for availability.
You can perform a PING by executing the PING command-line via the Shell. Here is a reusable function to do just this:
Function Ping(Target) Dim results On Error Resume Next Set shell = CreateObject("WScript.Shell") ' Send 1 echo request, waiting 2 seconds for result Set exec = shell.Exec("ping -n 1 -w 2000 " & Target) results = LCase(exec.StdOut.ReadAll) Ping = (InStr(results, "reply from") > 0) End Function
Now to use that code you simply pass the IP address or hostname to the Ping function and check the boolean result
If Ping("192.168.1.100") Then ' Do something to access the resource End If
You can optionally adjust the number of times the ping request is sent and the timeout interval to wait for the result.