Ethernet
The function blocks for Ethernet communication are used to exchange data between Ethernet devices via User Datagram Protocol (UDP), Transmission Control Protocol (TCP), and Transport Layer Security (TLS) protocol.
TCP communication
TCP (Transmission Control Protocol) is a connection-oriented protocol that enables to send and/or receive streams of data between two endpoints via a network connection. Connection-oriented means that first a connection between the communication partners must be established before the data can be exchanged. During the data exchange, the connection remains open. When the data exchange is finished, the connection has to be closed. TCP includes error checking and guarantees complete delivery of data, including the order in which the packets were sent.
The following function blocks are available for communication via TCP:
Function | Short description |
---|---|
TCP_SOCKET | Opens a TCP socket for communication via Transmission Control Protocol (TCP) |
TCP_SEND | Transmits data to a connected device via TCP |
TCP_RECEIVE | Receives data from a connected device via TCP |
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.
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 |
Further Info
For a description of the previous implementation of the Ethernet function blocks for secure data exchange via Transport Layer Security (TLS) protocol, see the "PLCnext Controller Function Blocks - Ethernet" help chapter. |
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, new UDP function blocks are available that support broadcasting.
The following function blocks are available for communication via UDP:
Function | Short description |
---|---|
UDP_SOCKET | Opens a UDP socket for communication via User Datagram Protocol (UDP) |
UDP_SEND | Transmits data to a remote device via UDP |
UDP_RECEIVE | Receives data from a remote device via UDP |
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. |