[Python-Dev] sharing sockets among processes on windows

Kristján Valur Jónsson kristjan at ccpgames.com
Wed Mar 14 01:27:14 CET 2012


Hi,
I´m interested in contributing a patch to duplicate sockets between processes on windows.
Tha api to do this is WSADuplicateSocket/WSASocket(), as already used by dup() in the _socketmodule.c
Here´s what I have:

1)      Sockets have a method, duplicate(target_pid), that return a bytes object containing the socket info for the target process

2)      When socket(x, y, z, data) is called with this bytes object as the fourth argument, it is recreated from that.

What are your thoughts on this?  Also, should I try to reuse the socket.dup() function somehow, perhaps by giving the target pid?
Secondly, there is multiprocessing.reduction which is doing similar things for unix.  Does anyone familiar with it know how it goes about doing this?  Would it be simple to change it to use this mechanism on windows?

Kristján
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120314/1cd4bd7b/attachment-0001.html>


More information about the Python-Dev mailing list