diff --git a/io/zenoh-links/zenoh-link-udp/src/multicast.rs b/io/zenoh-links/zenoh-link-udp/src/multicast.rs index 96d89a4b49..838bb8acd5 100644 --- a/io/zenoh-links/zenoh-link-udp/src/multicast.rs +++ b/io/zenoh-links/zenoh-link-udp/src/multicast.rs @@ -236,9 +236,12 @@ impl LinkManagerMulticastUdp { mcast_sock .set_reuse_address(true) .map_err(|e| zerror!("{}: {}", mcast_addr, e))?; - mcast_sock - .set_reuse_port(true) - .map_err(|e| zerror!("{}: {}", mcast_addr, e))?; + #[cfg(target_family = "unix")] + { + mcast_sock + .set_reuse_port(true) + .map_err(|e| zerror!("{}: {}", mcast_addr, e))?; + } // Bind the socket: let's bing to the unspecified address so we can join and read // from multiple multicast groups.