0

Running a C++ program via VS2015 IDE in debug mode and it shutting down incorrectly causes rogue processes to keep on listening to the TCP port it uses.

When I get to re-run the application in debug mode, although the application thinks it is listening to the TCP port, it actually isn't due to the rogue process(es) that previously weren't closed down properly.

I am trying to kill these processes but they will only show up in TCPView.exe

https://learn.microsoft.com/en-us/sysinternals/downloads/tcpview

I have read this:

Really killing a process in Windows

but no solutions provided there work in my case. The only remotely promising solution might be ntsd.exe but it is not supported on Win7 or Win10, so I could not actually test it. Using an IDE debugger like the one with VS2015 only shows working PIDs (i.e. non-ghost).

I want to find a way to remove these processes without having to restart or log in/out of my machine.

Can anyone help?

Thanks.

chara
  • 73
  • 5
  • Have you tried setting the reuse flag when opening the socket? – Alan Birtles Jan 18 '19 at 10:34
  • A [mcve] might help too – Alan Birtles Jan 18 '19 at 11:36
  • Thank you @AlanBirtles. I have managed to 'delete' the rogue processes by running the application again in debug mode (VS2015) and each time (while the application was running) to delete the ghost processes via Tcpview.exe. I had 3 ghost processes all related to the same application listening to a particular port, and doing this trick, it eliminated them one by one. – chara Jan 21 '19 at 13:41

0 Answers0