There is an integrated TCL interpreter program (called TT bar) to execute a script with exec to start a process (PP), the TT itself creates a socket port to communicate with other programs. At this point, the shutdown tt,pp is still running, use Netstat to view the port number, discover that the port number created by TT still exists, and that the port number cannot be created again. Note The port is not closed, but TT has exited, very strange. Then we look at the exec implementation and find that the process is created using CreateProcess, whose fifth parameter is to set the inheritance handle, which is unconditionally set to true in the exec implementation. This should be the reason, socket handle quilt process inherited, handle is the resources of the operating system, pp does not exit of course will not be released, so the TT created socket port has been occupied.
From the above question think about the things to note when using CreateProcess, if you do not need to continue the parent process handle do not set to true, so as not to create unnecessary trouble. At the same time, the general boot process can also use a few simple APIs, such as Winexec,shellexecute.