What is the correct way of reusing ports with gen_udp
in OTP26.1?
Previosly, we did gen_udp:open(Por, [{inet_backend, socket}, {reuseaddr, true}])
and I see reuseport
was added in [erts, kernel] reuseaddr/reuseport/exclusiveaddruse support/fixes by rickard-green · Pull Request #6522 · erlang/otp · GitHub but I don’t get it to work:
1> gen_udp:open(88888, [{inet_backend, socket}, {reuseaddr, true}, {reuseport, true}]).
{ok,{'$inet',gen_udp_socket,
{<0.92.0>,
{'$socket',#Ref<0.1985961887.3750363144.125730>}}}}
2> gen_udp:open(88888, [{inet_backend, socket}, {reuseaddr, true}, {reuseport, true}]).
{error,eaddrinuse}
In OTP26.0.2:
1> gen_udp:open(88888, [{inet_backend, socket}, {reuseaddr, true}]).
{ok,{'$inet',gen_udp_socket,
{<0.26238807.0>,
{'$socket',#Ref<0.3205098475.2836529154.55286>}}}}
2> gen_udp:open(88888, [{inet_backend, socket}, {reuseaddr, true}]).
{ok,{'$inet',gen_udp_socket,
{<0.26238551.0>,
{'$socket',#Ref<0.3205098475.2836529154.59029>}}}}