 |
ALPHA-VISION® Runtime: Reliable UDP Multicast
|
Reliable UDP Multicast
SUMMARY
Description of the reliable UDP multicast protocol used by various ALPHA-VISION
® components.
CONTENTS
- Packets
- Packet Header
- General Remarks
- Rollback
- Partial Packets
- Redundancy
Packets
All communication is done via UDP multicast packets of up to 1048 bytes length.
The packet header is 24 bytes.
More than 1024 bytes of data are divided into several (partial) packets.
Note:
The 1048 byte limitation is only the default, any other packet size
supported by the UDP protocol is also possible but possibly with
lesser performance.
Packet Header
| Bytes |
Field |
Meaning |
| 0..3 |
SenderId |
The station which sent the packet |
| 4..7 |
PacketId |
The packet id (telegram counter), used to determine missing packets.
A packet id of 0 indicates that the sender has reset it's packet id and will always be accepted by the receiver.
This is usually the case when sending a general query or after receiving a PACKETIDTOOLOW telegram.
With the exception of lifesign packets the packet id is incremented for each packet.
|
| 8..11 |
ReceiverId |
-1 for broadcast
If the packet shall be evaluated by a single station only then the station id is sent.
All other stations than ignore this packet.
|
| 12..15 |
PacketType |
Valid PacketTypes:
- 0 - NORMAL
- A normal data packet. Th data portion contains up to 1024 bytes of application dependent data
- 1 - ROLLBACK
- A rollback request. The receiver has detected a missing packet and requests the sender to re-send
all packets starting from the missing packet.
The data portion contains the missing packet id as signed 32-bit integer in network byte order
- 2 - LIFESIGN
- A lifesign packet is sent if the sender has no normal data to send within a timeout interval.
The packet id of a lifesign packet is the same as the packet id of the last normal data packet of the same sender.
The data portion is empty.
- 3 - PACKETIDTOOLOW
- The receiver has received a packet with an id that is lower than the
expected packet id - minus the rollback buffer size.
Note:
This is usually the case if a packet with an id of 0 has been lost.
Without the 'packet id too low' detection the station would discard all packets until the expected packet id is reached.
The data portion is empty.
|
| 16..19 |
TotalPacketLength |
The length of the data portion in bytes.
If data is split among multiple partial packets this is the overall length of the data in bytes.
This value is used to calculate the number of partial packets to be expected.
It is the real length, not just a multiple of 1024.
|
| 20..23 |
PartialPacketId |
Always 0 for single packets.
If data is split among multiple partial packets this is 0 for the first partial packet, 1 for the second partial packet
and so on.
A receiving station uses the PartialPacketId to re-assemble the data in the correct order.
|
All fields are signed 32 bit integers and are sent in network byte order.
General Remarks
-
Each station remembers the expected packet id for each other station.
This is the packet id of the last valid packet from this sender plus 1.
A packet is considered as valid if it's packet id is equal to the expected packet id.
After a gap in the packet ids has been detected all following packets are discarded,
even if their packet ids are valid with respect to their respective immediate predecessor.
-
If a received packet has a packet id lower than the expected packet id from that sender, the packet is ignored.
-
If a received packet has a packet id that is less than the expected packet id minus the rollback buffer size
then a PACKETIDTOOLOW packet is sent back to the original sender
which usually resets it's sending packet id again and sends a general query answer.
-
Each station uses the same packet id for sending packets to all other stations.
-
Packets with unknown packet type are discarded.
-
Packets with a packet length of less than 24 bytes are discarded.
Rollback
-
Each station usually has a rollback buffer where the last sent packets are stored.
-
If a station receives a rollback request for a packet which is no longer in it's rollback buffer,
then it sends a general query answer.
-
The rollback buffer may be omitted in the implementation of the station.
In this case every rollback request is treated as a general query request.
-
The normal answer to a rollback request is re-sending the packet
requested in the 4 data bytes of the rollback request packet.
Then the packet with the next higher packet id is sent and so
on until all packets including the newest packet are sent again.
Partial Packets
-
If a partial packets with an invalid partial packet id is received (AFTER validating the general packet id)
then all other partial packets belonging to this packet are discarded.
A partial packet id is considered invalid if it is not equal to the partial packet id of the last valid packet plus 1.
-
When splitting data into partial packets all except the last partial packet must have a packet length of 1048 bytes including
the header.
Redundancy
-
Currently two redundant "lines" of communication are supported.
-
Redundancy works in the same way as desribed above, with the exception that all packets are sent and received via both
lines.
-
If a packet has been received on one line and is then received again on the other line,
it is discarded normally because the packet id is lower than the (updated) expected packed id.
-
If a packet is missing (the receiver receives a packet on one line with a packet id higher than the expected packet id)
the receiver has to wait for a certain time to receive the packet on the other line.