[issue17561] Add socket.create_server_sock() convenience function

2019-02-07 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: After careful thinking I realize I'm not completely sure about how to expose the IPv4/6 functionality yet. I prefer to defer it for later and start landing a bind_socket() utility function which serves as a base for this functionality. See: issue17561. -

[issue17561] Add socket.create_server_sock() convenience function

2019-02-07 Thread Jason R. Coombs
Jason R. Coombs added the comment: In issue24209, I ended up settling on this implementation (https://github.com/python/cpython/blob/f289084c83190cc72db4a70c58f007ec62e75247/Lib/http/server.py#L1227-L1234), which seems to work well. -- ___ Python

[issue17561] Add socket.create_server_sock() convenience function

2018-12-18 Thread STINNER Victor
Change by STINNER Victor : -- nosy: -vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue17561] Add socket.create_server_sock() convenience function

2018-12-18 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue17561] Add socket.create_server_sock() convenience function

2018-12-18 Thread Giampaolo Rodola'
Change by Giampaolo Rodola' : -- pull_requests: +10452 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue17561] Add socket.create_server_sock() convenience function

2018-12-16 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Interesting. Yes, I agree this proposal is still desirable. We can reuse socket.create_server_sock() in smtpd, ftplib, socketserver (issue20215) and http.server (issue24209) modules which will inherit dual-stack IPv4/6 capabilities for free. I should be a

[issue17561] Add socket.create_server_sock() convenience function

2018-12-16 Thread Jason R. Coombs
Jason R. Coombs added the comment: I do believe this issue is still important and relevant. See issue25667 for a duplicate ticket (and references to implementations) and issue24209 for another issue where this could have been applied. -- nosy: +jason.coombs versions: +Python 3.8 -Pyt

[issue17561] Add socket.create_server_sock() convenience function

2018-10-14 Thread Cheryl Sabella
Cheryl Sabella added the comment: Since Tulip/asyncio has gone through a lot of development since this issue was added, I wasn't sure if this has been included already or if there was still interest in it. In either case, I think it might be able to be closed, but I wanted to make sure firs

[issue17561] Add socket.create_server_sock() convenience function

2013-04-03 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Here's a patch for Tulip: https://codereview.appspot.com/8307045 Will ping Tulip's ml as well. -- ___ Python tracker ___

[issue17561] Add socket.create_server_sock() convenience function

2013-04-02 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue17561] Add socket.create_server_sock() convenience function

2013-04-02 Thread Guido van Rossum
Guido van Rossum added the comment: Nikolay, you may want to check out this Python tracker issue. Giampaolo: I didn't even know it was possible for a single socket to be dual-stack. (It would seem problematic for UDP recvfrom() for example.) In Tulip it does indeed make more sense to create sepa

[issue17561] Add socket.create_server_sock() convenience function

2013-04-01 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Being Tulip asynchronous I think that what it needs is an utility function which returns *multiple* sockets as are the addresses returned by getaddrinfo() and also possibly even disable the IPv4/6 dual stack in order to be consistent across all platforms.

[issue17561] Add socket.create_server_sock() convenience function

2013-03-29 Thread Guido van Rossum
Guido van Rossum added the comment: start_serving() in base_events.py. On Fri, Mar 29, 2013 at 4:58 AM, Giampaolo Rodola' wrote: > > Giampaolo Rodola' added the comment: > > >> Where should I look? > > Tulip is at code.google.com/p/tulip > > I meant in the code (and what needs to be done/refact

[issue17561] Add socket.create_server_sock() convenience function

2013-03-29 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: >> Where should I look? > Tulip is at code.google.com/p/tulip I meant in the code (and what needs to be done/refactored exactly). -- ___ Python tracker

[issue17561] Add socket.create_server_sock() convenience function

2013-03-28 Thread Guido van Rossum
Guido van Rossum added the comment: Tulip is at code.google.com/p/tulip On Thu, Mar 28, 2013 at 7:51 PM, Giampaolo Rodola' wrote: > > Giampaolo Rodola' added the comment: > > Yep, no prob. It would also be a good chance to test it in a real-world > app. Where should I look? > > -- > > _

[issue17561] Add socket.create_server_sock() convenience function

2013-03-28 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' : -- nosy: +josiah.carlson, loewis ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue17561] Add socket.create_server_sock() convenience function

2013-03-28 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Yep, no prob. It would also be a good chance to test it in a real-world app. Where should I look? -- ___ Python tracker ___

[issue17561] Add socket.create_server_sock() convenience function

2013-03-28 Thread Guido van Rossum
Guido van Rossum added the comment: Perhaps you can contribute something like this to Tulip? We've got code to run a server that can handle IPv4 and IPv6, but we currently don't have something that just creates a separate socket for each address family. Our UDP and TCP paths are also quite d

[issue17561] Add socket.create_server_sock() convenience function

2013-03-28 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: I managed to write a container class which listens on multiples addresses and uses select/poll on accept() as suggested by Charles. FWICT it seems to work pretty well and supports non-blocking sockets and timeouts (tested on Linux, Windows and OSX). It is a

[issue17561] Add socket.create_server_sock() convenience function

2013-03-28 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Agreed. Then it probably makes sense to expose also a socket.has_dual_stack() function so that the user can pre-emptively decide whether using a custom class. Updated draft patch is in attachment. -- Added file: http://bugs.python.org/file29600/socke

[issue17561] Add socket.create_server_sock() convenience function

2013-03-28 Thread Charles-François Natali
Charles-François Natali added the comment: > Providing a custom class instantiating two sockets looks like a dead end to > me though. To say one, what is getsockname() supposed to return? Same for > detach(), fileno(), 'family' and probably others I can't think of right now. Indeed. So we mig

[issue17561] Add socket.create_server_sock() convenience function

2013-03-28 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Thanks for clarifying, I have a better understanding of the problem now. Providing a custom class instantiating two sockets looks like a dead end to me though. To say one, what is getsockname() supposed to return? Same for detach(), fileno(), 'family' and pr

[issue17561] Add socket.create_server_sock() convenience function

2013-03-27 Thread Charles-François Natali
Charles-François Natali added the comment: > What you say is right but whether the kernel supports an hybrid IPv4/6 stack > or not there's not much we can do about it anyway. > Exactly what are you suggesting with the ServerSocket class you mentioned? > What do you expect it to do? There's a con

[issue17561] Add socket.create_server_sock() convenience function

2013-03-27 Thread Guido van Rossum
Guido van Rossum added the comment: Tulip has something similar. Someone should compare the two and make sure they are equivalent or similar. -- ___ Python tracker ___

[issue17561] Add socket.create_server_sock() convenience function

2013-03-27 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Side note: this is how in pyftpdlib I determine whether a platform supports the dual stack: def support_hybrid_ip_v4_v6(): # Note: IPPROTO_IPV6 constant is broken on Windows, see: # http://bugs.python.org/issue6926 sock = None try: if

[issue17561] Add socket.create_server_sock() convenience function

2013-03-27 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: What you say is right but whether the kernel supports an hybrid IPv4/6 stack or not there's not much we can do about it anyway. Exactly what are you suggesting with the ServerSocket class you mentioned? What do you expect it to do? Note that platforms suppor

[issue17561] Add socket.create_server_sock() convenience function

2013-03-27 Thread Charles-François Natali
Charles-François Natali added the comment: I think that's a good idea. However, there's a problem with the implementation: if one passes "" or None as address on a dual-stack node, the resulting socket will be either IPv4 bound to INADDR_ANY, or IPv6 bound to IN6ADDR_ANY, whereas one would exp

[issue17561] Add socket.create_server_sock() convenience function

2013-03-27 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue17561] Add socket.create_server_sock() convenience function

2013-03-27 Thread Giampaolo Rodola'
New submission from Giampaolo Rodola': Here's a function similar to socket.create_connection() which addresses all the repetitive tasks needed to order to create an IPv4/IPv6 agnostic server socket. -- components: Library (Lib) files: socket.patch keywords: easy, needs review, patch mes