Giampaolo Rodola' <g.rod...@gmail.com> added the comment:

After iterating over this over the last few days I realized it makes more sense 
to implement and discuss the whole thing in here and as a single PR, so sorry 
about previously splitting this in a separate ticket/PR. Relevant PR is now 
this one and is ready for review:
https://github.com/python/cpython/pull/11784
Relevant changes which probably require attention/discussion are: 

1) since it was sort of ambiguous I renamed "has_dual_stack()" to 
"supports_hybrid_ipv46()". There could be space for some bikeshed as we already 
have "socket.has_ipv6" so this may be "has_hybrid_ipv46()" called instead

2) if family is unspecified and determined from *host* (e.g. "localhost" or "") 
the function sorts getaddrinfo() results preferring AF_INET over AF_INET6

3) doc includes link to my http://code.activestate.com/recipes/578504 recipe 
for platforms not supporting hybrid_ipv46 natively

4) it may be worthwhile (or maybe not?) to have another complementary 
bind_sockets() (plural) function returning all items from getaddrinfo(). That 
would be useful for non-blocking apps/frameworks and could be reused by asyncio.

Also, I'm CC-ing people from issue20215 as it contains relevant comments.

----------
keywords:  -easy
nosy: +Carlos.Ralli, Paul Marks, andreasr, berker.peksag, dazhaoyu, 
gregory.p.smith, jleedev, jpokorny, martin.panter, nirs, r.david.murray
pull_requests: +11856
title: Add socket.create_server_sock() convenience function -> Add 
socket.bind_socket() convenience function

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue17561>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to