Enterprise Networking in LabVIEW 1
LabVIEW is a language oriented around the communication of data from one point to another, whether the origin is a data acquisition system, user input or the destination is a log file or a waveform graph. Sometimes you may find that although the destination and source are simple, the in-between may require different communication technologies. When the data acquisition system is geographically disparate from the client that reads the data to generate reports, often the easiest way to transfer information is by using a computer network or the Internet. This blog will cover basics of communicating using the TCP protocol.
TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are two industry standard communication protocols that are used and supported in every modern programming language. TCP is generally a one-to-one communication protocol that has built-in error checking. TCP and UDP are routable protocols that can traverse the internet.
Addressing or endpoint identification is handled using a specific protocol (e.g. TCP), IP Address and Port Number. An IP address will identify a specific network connection and a port will identify a specific endpoint/application that receives any information. An IP Address can be private (non-routable) or public (routable) address while a port can be well-known, registered or dynamic/private/ephemeral.
- Well-known: Ports from 0 - 1023, also known as system ports, often require admin/super user privileges to use.
- Registered: Port is registered with the IANA (Internet Assigned Numbers Authority) for a specific application
- Dynamic/Private/Ephemeral: ports that cannot be registered with the IANA (49152 - 65535)
The broadcast IP address for a network can be used for 1:N communication but is generally disabled or frowned upon in production. Other methods such as UDP multicast are more apt for that use case.
LabVIEW’s low level functions for TCP/UDP use the string data type for reading and writing data. Other data types can be converted into a consistent string using the unflatten/flatten functions for JSON, XML , String and Variant.
Below are two VIs included in LabVIEW as examples that demonstrate very basic TCP/IP communication between two endpoints located on the same machine. The example is located under <labview>\examples\Data Communication\Protocols\TCP\Simple TCP\Simple TCP.lvproj
The server will listen and wait for a connection on the local IP address (127.0.0.1) and a given port (6340). Once a connection is established, it will send 50 data points to the client every 100ms.
The client will attempt to connect to a server on the local ip address a given port (6340), once the connection has been made, it will convert the string into an array of double numerics.
Take note that the two examples above are incredibly simple and lack the robustness that should be present in a fully featured applications handling things such as: automatic reconnection, more complex data types and heartbeats.In the next installation of this blog series, we will tackle enterprise networking with an emphasis on N:N and 1:N communication using UDP multicast.
Today we sat down and talked with one of our Erdos Miller employees to learn about [..]
In a previous blog post on the building blocks of an MWD system, I mentioned that [..]
Finite Element Analysis (FEA) can seem like magic when you first use it. The program [..]