How to kill a particular tcp connection in windows?

On Linux we can kill an Established TCP Connection using tcpkill command.


For example, to drop all connection to/from a particular IP:

tcpkill host ipaddr

Or similary to kill all connection using port 21 at ethernet-1, by:

tcpkill -i eth1 port 21  

Similarly, i want to know what is the command to kill certain connection on windows, precisely windows 7. Like i can see a list of active connections by netstat -n, now i am wondering how to drop a particular or group of connections?


Solution 1:

The CurrPorts tool from Nirsoft seems to do that. Follow the link and search for 'Closing a Connection From Command-Line'.

Solution 2:

The Windows Sysinternals Suite contains a tool called TcpView. TcpView will show you all of the connections on your machine similar to netstat. It will also allow you to close the connection or kill the process hosting the connection.