Hacker News new | ask | show | jobs
by ctrlrsf 1633 days ago
Using socket option SO_REUSEPORT allows multiple processes to bind to same port.
2 comments

Is there any restrictions on this option? Eg only children of the same parent process are allowed to bind to same port. Otherwise how does the packet distribution work? And how does the response from that port work?
>So long as the first server sets this option before binding its socket, then any number of other servers can also bind to the same port if they also set the option beforehand. [...] To prevent unwanted processes from hijacking a port that has already been bound by a server using SO_REUSEPORT, all of the servers that later bind to that port must have an effective user ID that matches the effective user ID used to perform the first bind on the socket.

https://lwn.net/Articles/542629/

is this what it's actually doing though? It doesn't say the reuseport option to the listen directive is required for this.