How to bind all interfaces dual-stack?
See original GitHub issueI wish to write a server application that binds to all interfaces in a dual-stack IPv4/IPv6 environment.
I thought the example server would be doing that, as it appears to bind to ‘::0’. In other applications, like CherryPy, binding to that address makes the server available on all interfaces, IPv4 and IPv6, but in aiosmtpd, the server is only reachable on IPv6. As a result, when the application moves to an environment that only supports IPv4 (looking at you, Docker), the application is unreachable.
Reading up on the docs for create_server, I see that passing a None value for the host should bind to all interfaces on both stacks, and indeed, that’s the behavior I see.
But aiosmtpd doesn’t allow passing None due to the the localhost default behavior.
I did find one interface that worked, but I’m not happy with it:
cont = controller.Controller(proxy, port=8025)
# no really, I want all interfaces
cont.hostname = None
cont.start()
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)

Top Related StackOverflow Question
I think we can label this issue “rubber ducking” 😃
Thanks for the PR and for figuring this out!
I’ve presented a PR, and that approach feels minimally invasive to address the concern.