Reference Design Content

cancel
Showing results for 
Search instead for 
Did you mean: 

Multi-Client Server Application Design Pattern using STM

This example is a client server design pattern that can run indefinitely, continuously monitoring for new connections and servicing them accordingly.

 

Requirements 

Software

  • LabVIEW Full Development System, version 2010 or later
  • Simple Messaging (STM) Library, version 3.0 or later, which can be installed from VI Package Manager
  • Running the RT Server VI on an RT targets requires the LabVIEW Real-Time module, and the driver specific to your target hardware.

Hardware 

A real-time hardware target, such as a PXI or CompactRIO controller, is required to run the RT Server VI.

 

Installation and Support

 

  • The contents of the attached ZIP file can be placed in any directory. 
  • Questions and feedback on this example should be posted in the STM Discussion Forum.

 

Background

 

Client/server systems provide access to a central application from one or more remote clients. For example, a server application may perform some measurement or automation function (such as test cell control) and client applications may provide operators with a user interface for monitoring the state or progress of that function.

In multi-client applications, clients may connect and disconnect at random times. For example, during HIL batch tests that run for extended periods of time, various users may connect to the system several times a day to check on the progress and status of test that are of interest to them.
 

Example Application

A detailed description of this design pattern and the STM Connection Manager is provided in the in the attachment PDF below - Multi-Client Server Application Design Pattern Using Simple Messaging Library (STM).pdf.

 

The example provides a design pattern for implementing an application that provides a single network-based server and has multiple clients connect to the server to exchange data between client and server. It uses the STM (Simple Messaging) Reference Library for data communication between client and server. 

 

The example application has the following features:

 

Server

  • Simulates the acquisition of 4 data channels
  • Accepts connections from any number of clients
  • Receives commands such as stop and desired channel from the client

Sends data to each of the connected clients. Each client only receives the data they requested.

 

Client (each client is identical)

  • Connects, disconnects and reconnects to the server
  • Sends commands such as stop and desired channel
  • Receives data from the server and displays it on a graph

 


Figure 1. Multi-client Server Overview

 

 Steps to Run Example

 

  1. Open the STM Multi Client Server Example project.
  2. From the project open the STM Multi-Client - Server VI.
  3. Open the STM Multi-Client - Client VI template, or create multiple client VIs from the template VI using the New VI from Template option in LabVIEW.
  4. Run the server VI.
  5. Set the Target IP address in each client to match the IP address of the server. Run each client VI.
  6. Change the Channel setting in the client to choose a different waveform.

STM Multi Client Single Server Front Panels.png

 

 

 

 
authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX