We have just posted an update to vuFileTools and wanted to let everyone know what changed.
First, there is a bug fix in vuFileCopy. It was an edge case Copy/Rename scenario where the vuCopy procedure was creating a folder with the Destination name and then putting the file in the folder with the same name as the Source filename. This update corrects that behavior so directory copy and rename combinations work as expected.
Second, we have expanded and clarified the network and Internet detection functions.
vuNetworkPresent has been tightened up so its behavior and return values are clearly defined:
0 = No network detected
1 = LAN present
2 = WAN (RAS or VPN style connection) present
3 = Both LAN and WAN present
CASE vuNetworkPresent()
OF 0
MESSAGE('No network detected.')
OF 1
MESSAGE('LAN connection detected.')
OF 2
MESSAGE('WAN (RAS or VPN) connection detected.')
OF 3
MESSAGE('Both LAN and WAN connections are present.')
END
This is still a network presence check only. It tells you what Windows reports about network connectivity, not whether the machine can actually reach the Internet.
New Internet Related Functions
To cover the Internet side more directly, there are two new functions:
vuInternetPresent
This asks Windows whether it believes Internet connectivity is currently available. This is a quick heuristic and does not contact any specific server. It returns 0 (no or unknown Internet) or 1 (Internet reported as available).
IF vuInternetPresent()
MESSAGE('Windows reports that Internet connectivity is available.')
ELSE
MESSAGE('Windows does not report Internet connectivity, or status is unknown.')
END
vuInternetCanReachUrl
This tries to open a specific URL within a timeout that you supply. It returns 1 if the URL is reachable within the timeout, 0 if it is not reachable, and -1 for parameter or setup errors. Use this when you need to know if a particular service endpoint is available right now.
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
Documentation for all three functions is online here:
vuInternetPresent
vuInternetCanReachUrl
vuNetworkPresent
If you already own vuFileTools, you can download the updated build from the ClarionProSeries web site using your existing credentials.
If you do not have it yet, vuFileTools provides over 200 utility functions for Clarion and is available here:
https://www.clarionproseries.com/html/vufiletools.html
Upgrades from older versions are available there too.
Charles