What properties, advantages and special features does the UDP protocol offer?
The UDP protocol was introduced to transfer data quickly and simply. The UDP protocol is on Level 4 (Transport Layer) of the ISO-OSI reference model and is thus also based on the IP layer (Layer 3). The recipient of data is therefore addressed using IP addresses. Only minimal administration information is add to the data packet to be sent, so that the data throughput is higher compared with TCP/IP.
Fig. 01 - Position in the ISO-OSI reference model
Properties of the UDP protocol:
Considering the requirement to transfer data rapidly, the UDP protocol only provides basic functions. Thus data can be exchanged between communicating partners with a minimum of effort. There are no safety mechanisms as with TCP/IP. The UDP protocol is connectionless and packet-oriented.
Fig. 02 - Structure of a UDP datagram
Socket and ports:
Several processes can run simultaneously on multitasking operating systems, whereby each process can provide multiple services. They should be able to be addressed separately.
For this reason, special interfaces, or ports, are defined for data communication both in the TCP/IP and the UDP protocol. This expansion of the host-to-host transfer to a process-to-process transfer is termed application multiplexing and demultiplexing.
Together with the IP address for a station, the port numbers (local and remote) form a socket which is defined as the unique address of the user program in the entire network. Therefore, any of a process's services can be addressed to a station within a network using a socket.
In the SIMATIC environment, multiple "simultaneous" processes or user programs cannot be created on one CPU. However, multiple communication jobs may be initiated simultaneously. In order to facilitate unique addressing here as well, assignment must take place via the connection configuration. Connection types (in the SIMATIC configuration NetPro):
|Specified UDP connection
|- local node and connection partners are firmly configured|
- the connection partner can be inside or outside the STEP 7 project
|Unspecified UDP connection 1)||- only the local node is defined in the connection configuration|
- addressing of the partner is via port and IP address upon block call
|Broadcast 1)||- an active node sends data to all other nodes|
|Multicast 1)||- an active node sends data to one firmly configured group of nodes|
Performance data and quantity framework of the UDP protocol:
|Criterion||Performance data||Additional information|
|Transmission medium||Cable, fiber-optics, radio|
|Transmission rate||Independent of network, up to 1 Gbit|
|Connectable devices and access procedures||- Point-to-point
|Acknowledgment||The protocol only acknowledges successful sending of the data into the network and not the arrival of the data at the target station. The user program must take care of securing consistency and data preparation.|
|Data volume||1 - 2048 bytes|
|Number of possible connections||Up to 16 per S7-300 CP
Up to 64 per S7-400 CP
Advantages of the UDP protocol:
- very rapid data transfer
- very flexible, can be well implemented with third-party systems
- multicast-compatible / broadcast-compatible
- suitable for small-to medium volumes of data (<= 2048 bytes)
Disadvantages of the UDP protocol:
- lost data packets are not sent again
- data packets with checksum errors are discarded and not requested again
- multiple settings of individual packets is possible
- the order of arrival of the packets at the receiver's end cannot be predicted
- data is transferred packet-oriented (not stream-oriented)
- broadcast function can only be used in send direction
- Entry ID 20983558 provides a complete example of a UDP multicast communication.
- General information on communication via SIMATIC S7 is available in Entry ID 20982954.