Dave Page <dpage@postgresql.org> writes:
> Stephen Frost wrote:
>> I'm curious as to which Unix systems allow multiple processes to listen
>> on the same port at the same time.. On Linux, and I thought on most,
>> you get an EADDRINUSE on the listen() call (which the postmaster should
>> pick up on and bomb out, which it may already).
> Linux certainly does.
Mmm, you're right, I misread the man page:
Setting the SO_REUSEADDR option allows the local socket address to be reused in subsequent calls to bind().
Thispermits multiple SOCK_STREAM sockets to be bound to the same local address, as long as all existing sockets
withthe desired local address are in a connected state before bind() is called for a new socket.
The bit about "connected state" is relevant here --- a listening socket
isn't connected. Time for more caffeine.
> Windows seems to treat SO_REUSEADDR in the same
> way as SO_REUSEPORT which just seems wrong.
Well, Microsoft getting standards wrong is no surprise. So what do we
want to do about it?
regards, tom lane