Reference Design Content

Showing results for 
Search instead for 
Did you mean: 

Multi-Client Server Application Design Pattern using STM

This document describes a server application design pattern that supports multiple client connections. It extends the command-based STM communication example to handle dynamic connections and disconnections.




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 Multi-Client Server Application Design Pattern Using Simple Messaging Library (STM) tutorial.


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:



  • 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




Running the RT Server VI on an RT targets requires the LabVIEW Real-Time module, and the driver specific to your target 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.


authored by
Christian L, CLA
Principal Systems Engineer - Partner and Ecosystem Development - National Instruments
Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for
use in hazardous environments. You assume all risks for use of the Code, and use of the Code is subject to the Sample Code License.