UDP
This sample demonstrates how to set up a publisher and subscriber based on OPC UA Pub/Sub UDP. The sample solution contains a TwinCAT project that includes the following PLC configuration:
- a PLC project that generates random data and links the data with data sets on the OPC UA RT Device’s publishers.
- a PLC project that stores the data received by subscribers on the OPC UA RT Device.
The I/O configuration includes an OPC UA RT Device with two publishers and two subscribers:
- a publisher that is configured to include a data set with variables. The variables are linked via the process image to the output variables of the first PLC project.
- a publisher that is configured to include a data set without variables. The variables are linked internally via their ADS symbol names to variables in the first PLC project.
- a subscriber that is configured to subscribe to the data published by the first publisher. The input variables are linked with variables from the second PLC project.
- a subscriber that is configured to subscribe to the data published by the second publisher. The input variables are linked with variables from the second PLC project.
![]() | Creation of the subscribers The subscribers have been created automatically based on the Configuration import/export. We highly recommend using this exchange format wherever possible. |
How to start the sample
Before you activate the sample project, the OPC UA RT device needs to be set up for a network interface card that has the TwinCAT Realtime-Ethernet Adapter driver installed. This can be done via the OPC UA RT device settings dialog.

Please also make sure that your system meets the system requirements.