AN004. How to Send the Same Data to Several DS
What's in this Application Note
We are often asked if it is possible to send the same data to several DS at the same time. We understand why such need may arise. For example, in RS485 systems there is often a master "node" that sends commands to several slaves. Every slave receives the command but only a particular one will reply back. This is because the frame (packet) sent by the master contains an address of the slave being addressed.
Network-enabling such system requires that this "send to all" communications method is somehow adopted to network communications. This Application Note explains how this can be done.
Contents:
Using UDP broadcasts to emulate multi-drop communications
Limitations
Using UDP broadcasts to emulate multi-drop communications
The only way to arrange multi-drop communications system on the TCP/IP network is by using UDP/IP protocol and sending data as UDP broadcasts. TCP protocol is, by definition, a point-to-point protocol and cannot be used for data delivery to several nodes simultaneously. UDP, on the contrary, can and is often used to send the data to several nodes on the network.
To make one DS (we will call it "master") send data to several other DS ("slaves") through the network perform the following setup (only "important" setup changes are shown):
• | On the master DS side make the following setup changes: |
• | Routing Mode (RM) setting: 1 (server/client) or 2 (client); |
• | Transport Protocol (TP) setting: 0 (UDP); |
• | Destination IP-address (DI) setting: 255.255.255.255- this will make the master DS send data as link-level UDP broadcasts. |
• | On each slave DS make the following setup changes: |
• | Routing Mode (RM) setting: 0 (server); |
• | Transport Protocol (TP) setting: 0 (UDP); |
• | Broadcast UDP (BU) setting: 1 (enabled)- this will make slave Device Servers accept the data sent in broadcast packets. |
Same can be applied to using Virtual Serial Port as a "master". Use VSP Manager and set the properties of the VSP in a way similar to the setup of the master DS.
Limitations
It is important to understand the limitations of such a system:
• | Unreliable data transmission. UDP, as opposed to TCP, does not guarantee data delivery. If any UDP packet is lost the UDP protocol itself won't be able to detect this. UDP packets are considered to be "less important" (compared to TCP traffic) so many routers drop such packets first when becoming overloaded. The bottom line is that you should not base your system on the assumption that all UDP packets will always be received by all slaves. This is usually not a problem since most multi-drop systems include some sort of retry algorithm. |
• | The system is limited to local network segments only. This second limitiation is more serious. Broadcast UDP packets are not routed by network equipment such as routers, bridges, etc. This means that UDP broadcasting is only possible within a single network segment. Do not expect to be able to make such a system work throught the Internet, for instance. |