To do this you must run it as administrator, of course. There is at least one program ( CurrPorts) that does exactly this and I used it today for the purpose of closing specific sockets on a process that was started before CurrPorts was started. ![]() So all you really need is either for Windows to provide an API that allows this directly, or for someone to have written a program that operates somewhat like a VPN or Fiddler and gives you a way to close sockets that pass through it. Consider for a moment that the remote machine, the network card, the network cable, and your OS can all cause the socket to close.Ĭonsider also that Fiddler and Desktop VPN software can insert themselves into the network stack and show you all your traffic or reroute all your traffic. You don't have to be the current process owning the socket to close it. Killing the process that owns the connection is really a bad idea here because this would take down the server (all users would lose functionality when we just want to selectively and temporally drop this one connection). Normally, I would add a firewall to do the job, but this would take some time, and I was in an emergency situation. this user is doing bad things, we asked them to stop but the connection didn't get dropped somewhere along the way). Then, I discover that this connection is undesired (e.g. A client makes a connection and port 56789 is allocated for it. ![]() I want to close/kill them.ĮDIT, for clarification: Let's say that my server listens TCP port 80. I don't want answers on how to monitor them (I already do this). But the answers looked like a manual page of netstat or netsh commands focusing on how to monitor the ports. Googling about this, I saw some people asking the same thing. ![]() Does somebody knows how to close a TCP or UDP socket for a single connection via windows command line?
0 Comments
Leave a Reply. |