Example Code

Filtering IPs in a LabVIEW Web Service Using LabVIEW

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

This example shows a quick way to filter IPs in the LabVIEW web service.


Description
The Read Request Variable VI allows us to retrieve specific information about the HTTP request to our LabVIEW Web Service.  This specific example retrieves the WS Requestor's IP Address and matches it to an array of allowable IPs.  If in the list, the VI is able to reverse an input string.

The URL format of the web service method is:  http://<IP Address>:<Web Server Port (8080)>/filter/reverse/:data where :data is the string that is to be reversed.

 
Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  • Replace the array of IP addresses with a file code module
  • Run the program

 

Additional Information or References
VI Snippet

3-306.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

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

Comments
Derrick123
Member
Member
on

How to get the original client IP with X-Forwarded-For in Labview Web Service? thanks