Edit: I can't see anything wrong with my question. It is not a duplicate, even though people have accused it to be. If you decide to down-vote the question anyways, please tell me why, so I can understand. Thank you.
How can I force another process to close a port that it is currently using. For example if Skype is listening on port 80 locally. How can I programmatically force Skype to release that port again, so that I can run XAMPP on the same port properly? Without changing Skype settings or closing Skype.
Yes, I know this might lead to unexpected behavior.
Is it just a matter of closing a handle using DuplicateObject or how is it done?
I'm not interested in closing the process or finding out which process is blocking the port. I already knkw how that's done properly even without netstat.
Edit:
I found WSADuplicateSocket which looked promising. But it has to be called from the process that already has the Descriptor identifying the local socket
as Microsoft calls it. If I could somehow get that Descriptor identifying the local socket
I might be able to call closesocket on that. This could probably be done with come code injecting, but I'm sure there is a better way.
Edit:
A tool called CurrPorts
is allegedly able to do what I'm trying to do. So it's definitely possible... but how?