New submission from Kristján Valur Jónsson <krist...@ccpgames.com>:

winsock natively supports the duplciation of sockets for use on different 
processes.  This patch proposes to add that functionality:
socket.duplicate(target_pid) gets a bytes representation of the duplicate 
socket, usable for the target process.
socket.socket(x,y,z,data) creates the socket object from the bytes 
representation.

The patch contains a test using multiprocessing that works.
Note that multiprocessing already contains its own code to achieve this, and 
that code can possibly be simplified with this patch.

Note also the new function "duplicate."  Perhaps "dup(target_pid) would be 
better?  But it would have different semantics.  
Also notice how we overload the "fromfd" parameter in socket.socket() to 
recreate a socket from a bytes representation.  Maybe this is not ideal?
Looking for thoughs here.

----------
components: Interpreter Core
files: duplicate.patch
keywords: patch
messages: 155842
nosy: krisvale
priority: normal
severity: normal
status: open
title: Socket duplication for windows
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file24854/duplicate.patch

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

Reply via email to