diff options
Diffstat (limited to 'man7/socket.7')
| -rw-r--r-- | man7/socket.7 | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/man7/socket.7 b/man7/socket.7 index 5284cf35f7..0571edbdd7 100644 --- a/man7/socket.7 +++ b/man7/socket.7 @@ -662,19 +662,37 @@ to bind to this port for any local address. Argument is an integer boolean flag. .TP .BR SO_REUSEPORT " (since Linux 3.9)" -Indicates that attempts to bind an identical listening address to -multiple +Permits multiple .B AF_INET or .B AF_INET6 -sockets by the same UID may succeed. -This option allows +sockets to be bound to an identical socket address. +This option must be set on each socket (including the first socket) +prior to calling +.BR bind (2) +on the socket. +To prevent port hijacking, +all of the processes binding to the same address must have the same +effective UID. +This option can be employed with both TCP and UDP sockets. + +For TCP sockets, this option allows .BR accept (2) load distribution in a multi-threaded server to be improved by using a distinct listener socket for each thread. -This option must be set on each socket prior to calling -.BR bind (2) -on the socket. +This provides improved load distribution as compared +to traditional techniques such using a single +.BR accept (2)ing +thread that distributes connections, +or having multiple threads that compete to +.BR accept (2) +from the same socket. + +For UDP sockets, +the use of this option can provide better distribution +of incoming datagrams to multiple processes (or threads) as compared +to the traditional technique of having multiple processes +compete to receive datagrams on the same socket. .TP .BR SO_RXQ_OVFL " (since Linux 2.6.33)" .\" commit 3b885787ea4112eaa80945999ea0901bf742707f |
