Dynamic selection for network service ports?

Chris Angelico rosuav at gmail.com
Wed May 1 03:55:26 EDT 2019


On Wed, May 1, 2019 at 5:44 PM Markus Elfring <Markus.Elfring at web.de> wrote:
>
> > You'll get anything in the ephemeral ports range.
>
> From which documentation source did you get this information for
> the handling of a zero as an useful setting?

If you don't bind to a port, you get an arbitrary port in the
ephemeral port range. That's just how BSD sockets work. Source: a
couple of decades of programming experience.

> > But the other cause is that you recently shut the server down,
> > and the port is still in the TIME_WAIT state.
>
> Does this technical detail occasionally increase the need to choose
> an additional number for a quickly restarted service in a dynamic way?
>
> > You can avoid this with the SO_REUSEADDR flag.
>
> Can such a configuration parameter be used also together with
> programming interfaces from the module “socketserver”?

How about you do some research with the socket module and see if you
can find answers in the docs. I have faith in you :)

ChrisA



More information about the Python-list mailing list