HomeModule 3 (Networks)Connect Labview Client/C-Server
I ntroduce
C onnect
A pply
R eflect
E xtend

Connect - Networks
Labview Client/C Server

This section on Labview-Client/C-Server Networking depends on code found in the compressed tar file lc_cs.tar. Download and decompress that file to access the directories and files described in this module.

In a similar fashion to the C-Client/C-Server model described in the previous Connect section, you can connect a labview client to a C program server. Since sockets use the TCP/IP protocol and labview is also capable of TCP/IP, making the connection between the C server and labview client is quite simple. The server remains exactly the same as before. The first thing needed in the labview diagram is the TCP Open Connection icon. The machine name and port number are wired directly into it, and is used to make the connection. In a similar manner as the c client, the labview client can read and write to the server. There is a TCP Write icon, a TCP Read icon and also a TCP Close Connection icon when the process is completed.

It is important to remember, since we are using TCP/IP that all the information needs to be converted to chars. Then, when information is received, it needs to be converted back to it's previous data type before it can be used. In labview these conversions can be made using the Type Cast icon. All you have to do is wire a constant of the data type that you want to convert to at the top of the icon and it will make the conversion.

There are three examples to look at in this section and they perform the same functions as the three examples as the previous section. The servers in each example stay relatively the same as before with only one or two subtle changes dealing with data transfer.

the first example is in the Cs_Lc/Cs_Lc1/ directory. After making the connection, the labview client transfers the two numbers that you give it and gets the product of those numbers from the server. Once you are finished you can click the switch to off, which will kill the connection. You can still compile the server by typing

>make all

The second example is also in the directory Cs_Lc/Cs_Lc2/. Just as before, this example sends over a group of information (called a cluster in labview instead of a struct in C) that is used to compute the new length of the object, which is then returned to the labview client.

In the final example found in Cs_Lc/Cs_Lc3/, a larger cluster is sent over to the server containing more than one set of variables. The new length for each set of variables is received in a for loop so that they could be easily inserted into an array and displayed.

Click here to move on to the next Connect section (Labview-Server/Labview-Client).