osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EXTERNAL: OSError: [Errno 48] Address already in use


On Wed, Jun 27, 2018 at 10:44 AM, T Berger <brgrt2 at gmail.com> wrote:

> On Wednesday, June 27, 2018 at 1:40:20 PM UTC-4, Marko Rauhamaa wrote:
> > Joaquin Henriquez <joaquin.henriquez at countercept.com>:
> >
> > >>Subject: EXTERNAL: OSError: [Errno 48] Address already in use
> > >
> > > The best way to help if got you to put the relevant code here.
> > >
> > > The error you are experiencing means that the Port you are trying to
> > > bind is already taken by another running process.
> >
> > That error usually takes place when restarting a server. The server
> > exited with one or more TCP connections open, which left the connections
> > in a TIME-WAIT state for some minutes. When the server is restarted and
> > tries to bind its address again, the ghosts of the previous connections
> > prevent the socket from being bound.
> >
> > The problem can be solved by turning on the SO_REUSEADDR flag of the
> > socket.
> >
> >
> > Marko
>
> Hi Marko,
>
> Can you please tell me how to "turn on the SO_REUSEADDR flag of the
> socket"?
>

Here's a small script that might serve as an example:
http://stromberg.dnsalias.org/svn/max-tcp-window/trunk/max-tcp-window

BTW, it's a security feature you're turning off. If you're on a multiuser
box, it prevents a second user from stealing lingering connections from a
first user on the same port.