[issue14310] Socket duplication for windows

Kristján Valur Jónsson report at bugs.python.org
Mon Mar 19 15:19:55 CET 2012


Kristján Valur Jónsson <kristjan at ccpgames.com> added the comment:

I like the idea of having a frominfo() function.  Though "info" is maybe too generic?  Also, dupinfo() is probably better than duplicate, even though there is no dup involved.

But I also wonder if we can make this windows/unix agnostic?
on unix, you would achieve the same thing by:
1) getting fd with fileno()
2) sending it over a unix domain socket using sendmsg() (used for duplicating fds betwerrn processes
3) calling fromfd() on the target host.

We could have a uniform process (more or less) if dupinfo(pid) would return a string containing the fileno on linux, and frominfo() were to accept such a string too.  The differeince between linux/windows would then be that linux needs to transfer the "info" between processes using the "magic" sendmsg() control info ona UNIX domain sock, whereas on Windows one can use whatever RPC one wishes.  To implement this, we could therefore have special "sendinfo" and "recvinfo" functions.

The process would then become, on either platform:
1) info = dupinfo(pid)
2) sendinfo(info)/info=recvinfo()
3) frominfo(info)

But again: "info" is very generic here.  any suggestions for a better name?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14310>
_______________________________________


More information about the Python-bugs-list mailing list