SOME/IP
Unicast or multicast events
With few subscribers the server sends every event to each of them in a message of its own, by unicast. With many, it sends one message by multicast to a group address that all of them listen to. A configured number of subscribers decides when the server changes from one to the other.
Two ways to send events
unicast
One message per subscriber
Each subscriber gets its own NOTIFICATION, sent to the Endpoint option of its SubscribeEventgroup, over UDP or over its TCP connection.
multicast
One message for all
One NOTIFICATION goes to a multicast address over UDP. The SubscribeEventgroupAck carries a Multicast option with that address, and clients start listening to it straight away so they miss nothing. TCP cannot do this.
The multicast threshold
Each event handler (the server side of an eventgroup) has a multicast threshold (the number of subscribers from which the server sends the events of the eventgroup by multicast instead of by unicast).
| Multicast threshold | Behaviour |
|---|---|
| 0 | Always unicast; never multicast. |
| 1 | Multicast from the first subscriber on; never unicast. |
| 2 or more | Unicast while there are fewer subscribers than the threshold; multicast as soon as the threshold is reached; back to unicast when subscribers leave and the count drops below it. |
Two things always go by unicast, whatever the threshold: the initial events for a new subscriber (they are only for that client) and all the eventgroup entries themselves (SubscribeEventgroup, Ack, Nack). A SubscribeEventgroup without a UDP Endpoint option is refused with a SubscribeEventgroupNack, unless the multicast threshold is 1 and the events therefore go only by multicast anyway.
Try it
Subscribe and unsubscribe clients, choose a multicast threshold, and send an event.
Things to notice. With multicast threshold 3, the second subscriber still gets its own message by unicast, and the third switches everybody to multicast: one message instead of three. Remove one subscriber and it switches back. The initial events for a new subscriber always come by unicast, even while everybody else receives by multicast.
Check yourself optional
New terms in this lesson
| Term | Meaning |
|---|---|
| multicast threshold | Number of subscribers from which the server sends the events of an eventgroup by multicast instead of by unicast; 0 means always unicast |
Source: SOME/IP-SD Protocol Specification, R20-11, sections 4.1.2.4 (multicast option), 4.1.2.6, 4.1.3.1 and 4.1.6 (threshold, adaptive state machine); Service Discovery, R20-11, section 7.6.5 and the description of SdEventHandlerMulticastThreshold.