subprocess (spawned by os.system) inherits open TCP/UDP/IP port

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Aug 22 10:58:24 EDT 2007


On 21 ago, 21:30, Seun Osewa <seun.os... at gmail.com> wrote:

> Is it possible to cause this sort of thing to happen on Windows.
> Specifically, I'm looking for a way to cause multiple processes to
> accept new connections on a bound socket.  on UNIX, I can just fork()
> after binding the server socket to a port and the children can
> accept() on that same socket, but on Windows, I don't know how to make
> that work. Any ideas?  Thanks!

Sockets are inherited by default, at least on any more-or-less-recent
Windows version (that is, not on Win9x). There is a specific Winsock
function (WSADuplicateSocket) and you can use the generic
DuplicateHandle too with bInheritHandle=TRUE.
Read about this on Microsoft site <http://msdn2.microsoft.com/en-us/
library/ms683463.aspx>

Note: Better to post a NEW message instead of replying to this old
thread.

--
Gabriel Genellina




More information about the Python-list mailing list