Determine whether or not Internet access is available by attempting an HTTP connection to the "Microsoft Network Connectivity Status Indicator" (NCSI) web service.
Use cases
Determine whether or not the RT target can connect to other Internet hosts
Validate the connection by checking the returned string from the web service
Code runs on either the RT target or PC host without modification
Use as a stand-alone VI or incorporate the code directly into your block diagram
Keep in mind
Requires the “HTTP Client with SSL Support” Academic RIO Device software set add-on
If your application does not otherwise require HTTP services, use the alternative TCP-based Internet access check method which simply checks if it is possible to connect to the NCSI service
LabVIEW block diagram elements
Locate these elements with "Quick Drop" (press Ctrl+Space and start typing the name); click on an icon to see more sample code that uses that element:
Example code
Connect your Academic RIO Device to your PC using USBLAN, Ethernet, or Wi-Fi. NOTE: Not all Academic RIO Devices have Ethernet and Wi-Fi connectivity options.
If using the NI myRIO 1950 or NI RIO Control Module start with the NI myRIO 1900 Archive.
Different IP address: Right-click on the "NI myRIO 1900" Device, choose "Properties", and then enter the new IP address
Different device:
Right-click on the top of the project hierarchy, select "New Targets and Devices", keep the "Existing target or device" option, and then find and select your particular device
Select all of the components under the "NI myRIO 1900" device: click the first one and then shift+click the last one
Drag the selected components to the new device
Right-click the "NI myRIO 1900" device and select "Remove from project"
Run “RT Main” and “PC Main” and observe the following:
Each VI executes the same subVI “check internet access (http).vi” once every five seconds and displays its result as the “Internet OK” Boolean indicator
Click the “dot-decimal notation?” control to switch between the machine name and the IP address
If you are using the USB cable to establish the network link between the Academic RIO Device and the PC, you should observe that the PC is host #1 (172.22.11.1) and the RT is host #2 (172.22.11.2) on the USBLAN network 172.22.11.0
“PC Main” will likely show other networks such as your wireless connection
“RT Main” will also show address 127.0.0.1 (“localhost”) – this address is for loopback testing and is internal to the RT target (in fact, every network host has its own loopback address)
If your wireless connection provides Internet service (e.g., with your consumer-grade wireless router) you can expect to see the “Internet OK” indicator activated
Try disabling your PC network connection to see the “Internet OK” indicator go out