TCP/UDP Communication FBs
The function blocks for Ethernet communication (TLS_*_2, UDP_*_2) are used to exchange data between Ethernet devices via User Datagram Protocol (UDP) and Transport Layer Security (TLS) protocol.
TLS communication
As of firmware version 2021.3, new function blocks are available that combine the handling of TCP and TLS and support the communication of one TCP/TLS server with several clients. The older TCP_* function blocks are no longer supported.
TLS (Transport Layer Security) is a cryptographic protocol which enables secure communication between the communication partners in the network. The TLS protocol works on top of TCP (Transmission Control Protocol). To enable communication and to exchange data with the TLS_SEND_2 and TLS_RECEIVE_2 function blocks, first a connection between the communication partners must be established with the TLS_SOCKET_2 function block. Then, the TLS protocol must be initialized by the TLS_SOCKET_2 FB. (Otherwise, TCP communication is possible.)
During the data exchange, the connection remains open. When the data exchange is finished, the connection has to be closed.
Note
The TLS_*_2 function blocks are newer implementations of the TLS_* FBs combined with the TCP_* FBs. The difference between the newer and the older implementations is that the TLS_*_2 FBs combine the handling of TCP and TLS communication and support both protocols. Furthermore, they support a TCP/TLS server which is able to communicate with several TCP/TLS clients. |
The following function blocks are available for communication:
Function | Short description |
---|---|
TLS_SOCKET_2 | Opens and closes a TCP/TLS socket and initializes TCP or TLS communication (depending on the input values) |
TLS_SEND_2 | Transmits data to a connected device via TCP/TLS |
TLS_RECEIVE_2 | Receives data from a connected device via TCP/TLS |
UDP communication
UDP (User Datagram Protocol) is a connectionless network protocol that exchanges so-called datagrams between UDP-capable Ethernet devices without acknowledgment. Connectionless means, there is no need to first establish a connection before sending or receiving the datagrams. The sender, for example, just sends the datagram and does not check that it was received by the receiver. The UDP datagram consists of the UDP header followed by the data. The addressing information, i.e., the information about the sender and the receiver of the datagram, is contained in the UDP header.
As of firmware version 2021.3, the UDP_*_2 function blocks are supported (FBs support broadcasting). The older UDP_* function blocks are no longer supported.
The following function blocks are available for communication via UDP:
Function | Short description |
---|---|
UDP_SOCKET_2 | New implementation of the UDP_SOCKET FB. Supports broadcasting. |
UDP_SEND_2 | New implementation of the UDP_SEND FB. Supports broadcasting if the socket has been created accordingly. |
UDP_RECEIVE_2 | New implementation of the UDP_RECEIVE FB. |
WARNING
|
Unintended machine operation Verify that the influence of the output data cannot result in an unintended or hazardous behavior of the entire system.1 |
1 | When running the application logic in simulation mode, the function blocks for Ethernet communication establish a real connection to other devices/servers. Thus, outputs and variables connected to real hardware may be set and therefore may cause real damage to the machine. |