Using
LabView To Get Data Over A Network Connection
This sub-vi gets a single string from over the connection. Here is
the sequence of events.
-
The first block is a TCP/IP
read that reads the length of the string. It is assumed that the
string length can be specified by a single integer, or in other words that
the string length is 0 to 9. That is specified in the constant 1
(blue box) input to the TCP/IP read.
-
The string length is itself
a string and is shown being displayed (you can eliminate the display) and
also converted to an integer.
-
That integer string length
is used in the second TCP/IP read which then reads the correct number of
bytes (in this case an error signal for a control system) and displayed.
-
To use the data in the
output string numerically will require converting it to the requisite number
format.
The
front panel for this sub-vi is shown below.

Note the following here.
-
There are two inputs to
the sub-vi.
-
The Connection ID
-
The Error Status signal
-
There are three outputs
from the sub-vi.
-
The Connection ID
-
The Error Status signal
-
The data that was received,
formatted as a string.
All of this leads to the following icon - with
inputs and outputs indicated - and which has been stored as TCPIPGet.vi.
Comments
This page shows a LabView
program implemented as a sub-vi. However, you can use the parts shown
here without building a sub-vi as long as you watch the data you need to
provide and the outputs as shown above.