sccn / liblsl

C++ lsl library for multi-modal time-synched data transmission over the local network
Other
108 stars 63 forks source link

Remove 127.0.0.1 from multicast addresses #92

Open tstenner opened 3 years ago

tstenner commented 3 years ago

multicast.MachineAddresses is set to {127.0.0.1} by default. In some cases, this is exactly what an end user wants (i.e. a local stream can be discovered even when the network isn't there. This doesn't use multicast, however, so the first socket to open the default port will be the only one to receive the discovery (and reply to them (even when multicast is enabled on the loopback interface):

$ sudo ip netns add lsl_localmc
$ sudo ip -n lsl_localmc link set lo up
$ sudo ip -n lsl_localmc link set lo up multicast on
$ sudo ip netns exec lsl_local build/testing/lsl_test_exported "resolve multiple streams"
-------------------------------------------------------------------------------
resolve multiple streams
-------------------------------------------------------------------------------
../testing/test_ext_discovery.cpp:7
...............................................................................

../testing/test_ext_discovery.cpp:14: FAILED:
  REQUIRE( found_stream_info.size() == n )
with expansion:
  1 == 3

So even though everything seems to work with a single stream, the stream discovery is broken. I therefore suggest to remove 127.0.0.1 from the local addresses and add an explanation how to fix it to the documentation (short version: add a multicast route to the device, i.e. sudo ip route add multicast 224.0.0.0/4 dev lo).