Example Code

UDP-based Chat Server and Client in 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
To use UDP to make a chat application.

Description:
This is an example of building a chatter application by using the UDP knowledge that can communicate accros the network. Features of them would be listed as follow:

Server
-Runs on your machine (or whenever you run it - but it's just one machine)
-Receives messages and passes them on to other clients using a queue
-Logs people on and off of the chat
-Keeps an up-to-date list of who is logged on (both username and IP address)
-Uses that list for point-to-point message sending (as opposed to network broadcast)
-Occasionally (every 2 sec) pushes that list to clients
-Logs conversation to file for evidence

Client:
-Runs on each computer (it needs the server address to find it)
-Logs you on and off, on startup and shutdown
-Displays list of people logged on to the server
-Displays history of the chat

Instructions:
To implement this example:
  1. Refer to the Readme within the ZIP files
  2. Run the Server
  3. Run the Client
  4. (Optional) Turn on the Highlight Execution to see the flow of the VI


To execute this example:

  1. Install the required software.
  2. Open the VI and refer the Implement Steps


Requirements
Software
LabVIEW 2012 or compatible

Hardware
-

bd1.pngbd2.pngfp1.PNGfp2.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.