Create a separate socket for transmitting data

This is a workaround for interoperability issues, ultimately driven by a
Windows quirk that makes multicast delivery within a machine utterly
unreliable if the transmitting socket is bound to 0.0.0.0 (despite all
sockets having multicast interfaces set correctly) when there are also
sockets transmitting to the same multicast group that have been bound to
non-0.0.0.0.  (Note: there may be other factors at play, but this is
what it looks like after experimentation.)

At least Fast-RTPS in some versions binds the socket it uses for
transmitting multicasts to non-0.0.0.0, so interoperability with
Fast-RTPS on Windows requires us to bind the socket we use for
transmitting multicasts (which was the same as the one we use for
receiving unicast data) also to non-0.0.0.0 or our multicasts get
dropped often.

This would work fine if other implementations honoured the set of
advertised addresses.  However, at least Fast-RTPS and Connext (in some
versions) fail to do this and happily substitute 127.0.0.1 for the
advertised IP address.  If we bind to, e.g., 192.168.1.1, then suddenly
those packets won't arrive anymore, breaking interoperability.

The only work around is to use a separate socket for sending.

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2020-03-07 17:47:18 +01:00 committed by eboasson
parent 9e673769ce
commit d1ed8df9f3
17 changed files with 102 additions and 108 deletions

View file

@ -638,7 +638,6 @@ reserved. This includes renaming or moving options.&lt;/p&gt;</xs:documentation>
<xs:element minOccurs="0" ref="config:AccelerateRexmitBlockSize"/>
<xs:element minOccurs="0" ref="config:AssumeMulticastCapable"/>
<xs:element minOccurs="0" ref="config:AutoReschedNackDelay"/>
<xs:element minOccurs="0" ref="config:BindUnicastToInterfaceAddr"/>
<xs:element minOccurs="0" ref="config:BuiltinEndpointSet"/>
<xs:element minOccurs="0" ref="config:ControlTopic"/>
<xs:element minOccurs="0" ref="config:DDSI2DirectMaxThreads"/>
@ -717,14 +716,6 @@ of HEARTBEAT messages.&lt;/p&gt;
day.&lt;/p&gt;&lt;p&gt;The default value is: &amp;quot;1 s&amp;quot;.&lt;/p&gt;</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="BindUnicastToInterfaceAddr" type="xs:boolean">
<xs:annotation>
<xs:documentation>
&lt;p&gt;Bind unicast sockets to the address of the preferred interface; if
false, bind to 0.0.0.0 (IPv4) or its equivalent&lt;/p&gt;&lt;p&gt;The default value
is: &amp;quot;true&amp;quot;.&lt;/p&gt;</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="BuiltinEndpointSet">
<xs:annotation>
<xs:documentation>