Research on TCP/IP network communication supported in LabVIEW
Introduction
LabVIEW has powerful network communication functions. This function enables LabVIEW users to easily compile LabVIEW Application Software with powerful network communication capabilities to implement remote virtual instruments. LabVIEW supports TCP/IP and UDP protocols. Moreover, ni also developed a datasocket technology, which greatly simplifies or even removes network communication programming. Users can easily implement high-speed data exchange on the Internet.
TCP/IP protocol (Transport Control Protocol/Internet Protocol) is the most basic protocol of the Internet. Due to the wide use of the Internet, TCP/IP has become the standard of reality. The introduction of this protocol is not the focus of this Article. For more information, see other documents.
Introduction to TCP nodes
In LabVIEW, TCP nodes can be used to implement LAN communication based on the TCP protocol. In function, communication, and TCP nodes, the nodes are divided into three parts:
Connection node: used to establish a connection between the client and the server
Transmission node: used to transmit data between the client and the server
Conversion node: used for switching between computer IP addresses and computer names
Dual-machine TCP communication process
Two communication modes
Communication between multiple hosts using LabVIEW
In multi-host communication implemented through TCP in LV, one end is set to the server end and the other end to the client. In this way, the server continuously listens during running, establishes a connection when a client is connected, and receives and sends data to form communication, after the client is running, it continuously tries to connect to the server. If there is no connection for some processing, it will send and receive data for processing after the connection. The VI graph structure is as follows:
Through the above method, you can easily implement multi-host communication.
One end uses Labview and the other end is another tool for communication.
In actual work, sometimes the lower computer or other machines use other languages or configuration tools. In this case, when implementing interactive communication between TCP, we can't deal with it like the above multi-host communication is written by Lv. How can we implement it. After research, it is found that LabVIEW provides the operation control technology. In semaphonre technology, this function can limit the number of tasks, and these tasks can simultaneously heap a shared resource for operation. Therefore, we are bold in using shared resource operation information to set other terminals as servers, and the local end as clients for operations, so that protected resources or critical zones can communicate externally, we can use this technology to synchronize multiple independent and parallel tasks, so that we can use a public semaphore to allow only one task to be executed at a certain time point.
This figure shows a brief function. If you are interested, you can follow the prompts above to make it perfect.
Note:
When establishing communication between the client and the server, in addition to specifying the Internet address, you must also specify the communication port number. The port number ranges from 0 to 65535. This port number distinguishes different communication services, this makes it easy to manage multiple communication connections. It is best to set the port number manually. It is best not to set it below 1000 (because the firewall may disable the port number lower than 1000 and the port number below 1000 is reserved for specific purposes)
The client and server must specify the ports, and the two ports must be the same for effective communication.
Before the client can establish a connection with the server, you must specify the name of the server. The name of the server refers to the name of the computer on which the server is running, the client's input server name can be either the computer name or localhost
When it comes to interfaces with multiple hosts and other languages, the execution queue is added according to the above three points, so that data is exchanged after the connection is successful, after the switch is complete, disconnect and then connect to the next one. In this way, the program is executed in sequence. Critical Zone Protection
Summary:
In LabVIEW, TCP is used for data sharing between two applications. The disadvantage is that it is not real-time. However, due to the popularity of TCP/IP, the application scope is constantly expanding. The above two points contain most applications. We can also use Windows ActiveX Control Winsock. I will make a special introduction in the following articles.
To use real-time data transmission, you can use datasocket technology, which is used to share and publish real-time data in measurement and automation applications and can be applied in any programming environment. This article mainly introduces TCP/IP. For real-time data transmission communication and control, we will introduce it in the following sections.
References
Yang leping, Tsinghua University Press, LabVIEW advanced program design
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/kw123/archive/2007/06/14/1652003.aspx