Example Code

LabVIEW Internet Connectivity Check & Modem Telnet Reboot

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

The attached VI checks internet connectivity by attempting a connection to the Google public DNS server (8.8.8.8).  If the connection fails for three consecutive minutes, a telnet connection is opened to a DSL modem and reboot commands are issued.

Description

I created this VI to deal with a flaky Zyxel C1100Z DSL modem.  It seemed that whenever my DSL connection went down, I had no choice but to either unplug or reboot the modem, or the connection would never recover on its own.  This example automates the process of checking internet connectivity and then automatically issuing the reboot command sequence over an unsecured telnet connection. Connectivity is monitored by attempting to open a TCP connection to Google's public DNS every minute. If this fails more than 2 times in a row we open a telnet connection to a modem and issue a reboot command using LabVIEW's TCP API.

Hardware and Software Requirements

  • LabVIEW 2014 (or compatible)
  • To fully utilize this example you will need a Zyxel DSL modem (or equivalent)

Steps to Implement or Execute Code

1. Simply run the VI (you may have to adjust your modem IP)

Additional Information or References

Ramirez Kleinigger Consulting, LLC
http://www.thinkrkc.com/

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.