RCP CL Comm Basic Stream Mixed Types Example RCP CL Comm Intermediate Stream Mixed Type Example navigation bar

Table of Contents >Quanser Rapid Control Prototyping Toolkit >Examples >Communications >

RCP CL Comm Intermediate Stream Example

This example consists of two communication VIs: a server and a client. It demonstrates how to use the CL Stream Call, CL Stream Answer, CL Stream Write, CL Stream Read VIs from the Quanser Rapid Control Prototyping Toolkit to establish a connection between two VIs. For a detailed description of these VIs and how they operate, please refer to the RCP CL Stream Answer, CL Stream Call, CL Stream Write, and CL Stream Read help pages.

System Requirements

Please refer to the Rapid Control Prototyping (RCP) Toolkit System Requirements to run this example. This example does not require any other hardware.

Configuring the Example

Open the RCP CL Comm Intermediate Stream Client Example.vi and the RCP CL Comm Intermediate Stream Server Example.vi under My Computer. To set up the example, select Show Block Diagram from the Window menu or press Ctrl+E while the Front Panel is the active window for both the RCP CL Comm Intermediate Stream Client Example.vi and RCP CL Comm Intermediate Stream Server Example.vi . Ensure that the URI for the server and client are the same in the pink text box, since both VIs run on the same machine. An example of a valid URI is tcpip://localhost:18000. The RCP URIs are described on the Universal Resource Identifiers page. Close the Block Diagram window after all changes to the VI have been made.

Running the Example

Click on the Run button for each VI or select Run from the Operator menu to begin each VI. Run the server, RCP CL Comm Intermediate Stream Server Example.vi, before running the client side, RCP CL Comm Intermediate Stream Client Example.vi.

Initially the server side will display 0 for the Received Data, New Flag, Peer Closed and Sent Flag graphs. This indicates that the server is not sending any data to the client and no data has been received from the client. The state box indicates whether the server has connected to a client. The value should initially be Not connected.

When the client is run it will establish a connection with the server. If the state box on the server doesn't change to Connected, the client failed to communicate with the server. The value for the New Flag and Sent Flag graphs will change to 1 showing that the server/client are receiving and sending data respectively. The Data Flag graph is displaying the data that is received from the server or the client. By moving the dial on the server or client side you can change the data that is transmitted.

Click on the Front Panel Stop button to stop the VI. Stop the client, RCP CL Comm Intermediate Stream Client Example.vi, before stopping the server side, RCP CL Comm Intermediate Stream Server Example.vi.

When the client is stopped the server side will return to its initial values. Peer Closed will spike to 1 before returning back to zero because the client closed the connection with the server.

 

navigation bar