Improve support for dynamic port allocations #10665
Labels
enhancement
good first issue
Good for newcomers
Hacktoberfest
We think it's good for https://hacktoberfest.digitalocean.com/
Is your feature request related to a problem?
When working with TCPSite and DNS-SD (aka mDNS, Zeroconf, Bonjour) services, it is useful to allocate a dynamic port number (as port discovery is handled by the DNS-SD system)
In order to do that today, one must write code like the following:
This is problematic because it encourages access to the internal
_server
field on the site object.Describe the solution you'd like
In TCPSite.start, the server socket could be queried like the above and stored on a public property.
Alternatively, a public
port
property on the TCPSite which does the above would be good for me.I would expect it to be an error to access the port property before the socket is bound.
Describe alternatives you've considered
My workaround descirbed in the first section works, but is not discoverable and fragile.
Related component
Server
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: