Eio.Net.listen and datagram_socket functions ignore reuse_addr and reuse_port parameter in luv backend (https://github.com/ocaml-multicore/eio/blob/main/lib_eio_luv/eio_luv.ml#L753-L754).
Some observations on luv backend:
it seems libuv creates tcp sockets with reuse_addr = true by default (https://github.com/libuv/libuv/blob/7bccb562e415030050cfbd1e69eeefd69ce57aca/src/unix/tcp.c#L164). Therefore if reuse_addr = false we need to set the socket option explicitly.
For udp sockets, it seems to be reuse_addr=false by default. (https://github.com/libuv/libuv/blob/dff3f8ccabee15b1545523329e39e7acd2e77563/src/win/udp.c#L221)
Eio.Net.listenanddatagram_socketfunctions ignorereuse_addrandreuse_portparameter in luv backend (https://github.com/ocaml-multicore/eio/blob/main/lib_eio_luv/eio_luv.ml#L753-L754).Some observations on luv backend:
it seems libuv creates tcp sockets with
reuse_addr = trueby default (https://github.com/libuv/libuv/blob/7bccb562e415030050cfbd1e69eeefd69ce57aca/src/unix/tcp.c#L164). Therefore ifreuse_addr = falsewe need to set the socket option explicitly.For udp sockets, it seems to be
reuse_addr=falseby default. (https://github.com/libuv/libuv/blob/dff3f8ccabee15b1545523329e39e7acd2e77563/src/win/udp.c#L221)