[erlang-questions] SO_REUSEPORT with UDP

Benoit Chesneau <>
Sat May 23 22:46:09 CEST 2015


On Sat, May 23, 2015 at 6:50 PM pablo platt <> wrote:

> From the stackoverflow link, SO_REUSEADDR let you use the same source
> address when a previous socket is closing (TIME_WAIT).
> SO_REUSEPORT let you use the same source address and port as long as the
> socket tuple is different.
> {<protocol>, <src addr>, <src port>, <dest addr>, <dest port>}
> On some systems (Linux =< 3.9, Windos) SO_REUSEADDR is the same as the
> combination of SO_REUSEADDR and SO_REUSEPORT.
>
> It seems that Linux and BSD use a slightly different raw setting for
> SO_REUSEPORT:
>
> https://github.com/aetrion/erl-dns/commit/0c8d768ae69773d2163ea0741125471983b9a57d#diff-06495a7d8430a91558d99be5f1209c32R83
> [{raw, 1, 15, <<1:32/native>>}];
>
> How can I build a UDP server that listen on a fixed {Addr, Port} and
> creates a new process for a new client connection?
> Does this suppose to work?
>

Of course it is:
https://github.com/refuge/rbeacon/blob/master/src/rbeacon.erl#L564-L599

- benoit

>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150523/4926ae3c/attachment.html>


More information about the erlang-questions mailing list