subprocess (spawned by os.system) inherits open TCP/UDP/IP port
seun.osewa at gmail.com
Wed Aug 22 02:30:03 CEST 2007
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!
> It doesn't actually move. Thefiledescriptor is a handle onto the port.
> A port can have multiple handles which refer to it. When you fork, you
> effectively copy the handle into another process. Now there are two
> handles onto the same port. If one of the processes exits, the other one
> still has a handle, and so the port still exists. If a process forks
> multiple times, then multiple copies are made. Each process can accept
> connections on the port through its own handle. Exiting just drops the
> handle, it doesn't close the port.
More information about the Python-list