I listen socket port 4000 in my process. I start another process using CreateProcess
witch using another port number. after exit my process, when i try to start it again i received this error even when the child process is killed:
Only one usage of each socket address (protocol/network address/port) is normally permitted.
But when i start this process normally from explorer the is no conflict happens. What should i do to release the port for my usage?
Edit: I use this code to create the new process.
CreateProcessW(NULL, pwszCommandLine, NULL, NULL, TRUE,
NORMAL_PRIORITY_CLASS | CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE,
NULL, NULL, &si, &pi)
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
I don't wait to process finish, because this process should not exit.