I have problem same as in this question.
PID exists in netstat but does not exist in task manager
I have discovered a running process with PID 26376 listening on port 9001 and 9002 as when I try to run my program(as a service) which binds to that port it fails.
But when I try to kill it using taskkill /PID it says that the process 26376 is not found. Similarly when I try to find the process in task manager with "Show processes from all users" selected, I couldn't find it anywhere.
And the accepted answer says:
What may be happening is that your process had a TCP port open when it crashed or otherwise exited without explicitly closing it. Normally the OS cleans up these sorts of things, but only when the process record goes away.
I am working on a C++ code and to fix an unknown/unresolved issue I am doing taskkill which sometimes locks the port. How do I free it on next use without restarting the whole OS? Is there any way to free such ports?