Experimental Physics and Industrial Control System
|
The SO_REUSEPORT option provides this capability — see https://lwn.net/Articles/542629/ for the full article. Here’s a summary:The basic concept of SO_REUSEPORT is simple enough. Multiple servers (processes or threads) can bind to the same port if they each set the option as follows: 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. The requirement that the first server must specify this option prevents port hijacking—the possibility that a rogue application binds to a port already used by an existing server in order to capture (some of) its incoming connections or datagrams. 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. SO_REUSEPORT can be used with both TCP and UDP sockets. With TCP sockets, it allows multiple listening sockets—normally each in a different thread—to be bound to the same port. Each thread can then accept incoming connections on the port by calling accept(). This presents an alternative to the traditional approaches used by multithreaded servers that accept incoming connections on a single socket.
But this seems like a fairly esoteric thing to do.
Why is bind() not returning EADDRINUSE the second time it is called on the same port on Centos6? Is there some socket option that allows multiple processes to bind to the same port?
|
- Replies:
- RE: Problem with procServ on RHEL6 Mark Rivers
- References:
- Problem with procServ on RHEL6 Mark Rivers
- RE: Problem with procServ on RHEL6 Mark Rivers
- Navigate by Date:
- Prev:
RE: Problem with procServ on RHEL6 Mark Rivers
- Next:
RE: Problem with procServ on RHEL6 Mark Rivers
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
<2016>
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
RE: Problem with procServ on RHEL6 Mark Rivers
- Next:
RE: Problem with procServ on RHEL6 Mark Rivers
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
<2016>
2017
2018
2019
2020
2021
2022
2023
2024
|
ANJ, 15 Jul 2016 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|