eclipse-cyclonedds / cyclonedds

Eclipse Cyclone DDS project
https://projects.eclipse.org/projects/iot.cyclonedds
Other
854 stars 352 forks source link

Multicast not support on qnx? #1061

Closed PandaSel closed 2 years ago

PandaSel commented 2 years ago

Set AllowMulticast to true in cyclonedds.xml, and after running two cyclonedds processes, the second processes show error log: "ddsi_udp_create_conn: failed to bind to 7400: address in use". is AllowMulticast not supported in qnx?

PandaSel commented 2 years ago

1624847925.259516 [0] 1: ddsi_udp_create_conn: failed to bind to ANY:7400: address in use 1624847925.260536 [] 1: dds_create_participant: Error

eboasson commented 2 years ago

From https://www.qnx.com/developers/docs/6.5.0SP1.update/com.qnx.doc.neutrino_lib_ref/g/getsockopt.html#SO_REUSEPORT:

SO_REUSEPORT level: SOL_SOCKET

Enables (nonzero) or disables (zero) duplicate address and port bindings. Complete duplicate bindings by multiple processes are allowed when they all set SO_REUSEPORT before binding the port. This option permits multiple instances of a program to each receive UDP/IP multicast or broadcast datagrams destined for the bound port. See the reuseport_unicast option of io-pkt to see how unicast packets are also received on all sockets bound to the same port.

So it clearly is supposed to work on QNX. The trouble is that I can't debug it because I don't have a QNX machine ...

I did recently change the way it decides whether SO_REUSEPORT can be used, trying to automatically do the right thing instead of requiring ever more extensive preprocessor conditions (#1029). If you are using current master, it would be interesting to know if it works in the version before that PR (i.e., b92b1bc716584fde3e57c96013b86149574dbc2b). Alternatively, if stepping through the code in a debugger is easy in QNX, you might want to set a breakpoint in ddsrt_setsockreuse and see what happens.

PandaSel commented 2 years ago

thank you very much,

i have fixed this issue. by using SO_REUSEPORT.

发自我的iPhone

------------------ Original ------------------ From: eboasson @.> Date: Mon,Dec 6,2021 3:37 PM To: eclipse-cyclonedds/cyclonedds @.> Cc: a438254702 @.>, Author @.> Subject: Re: [eclipse-cyclonedds/cyclonedds] Multicast not support on qnx?(Issue #1061)