Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Also see – Pacerier Jan 23 '15 at 15:39
up vote 5 down vote accepted

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

share|improve this answer
thanks, it seems to have licensing issues, dosen't look like free to me – Johnydep Feb 2 '12 at 16:13
from the product page: "This utility is released as freeware. You are allowed to freely distribute this utility via floppy disk, CD-ROM, Internet, or in any other way, as long as you don't charge anything for this. If you distribute this utility, you must include all files in the distribution package, without any modification !" that seems pretty free to me. – Peter Hahndorf Feb 2 '12 at 17:34

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.

share|improve this answer
thanks but I am more interested in something that is available as command line options because i need to integrate that in my application. I looked at Tcpvcon.exe which is shipped with Tcpview but i do not know how to close connection using that. Since on GUI, we simply right click and close connection, wondering how to do the same for this command line tool? Any idea/ – Johnydep Feb 1 '12 at 14:34
If you need to do it programmatically, use a Windows api. – ZippyV Feb 1 '12 at 15:22
@ZippyV, which API i should be looking at? – Johnydep Feb 2 '12 at 16:11
@Johnydep, Post the question on Stackoverflow. It will be answered in minutes hopefully. – Pacerier Jan 23 '15 at 15:51
My system, while TcpView is running, is super sluggish. E.g. Alt-Tab is sloooow and painful. CurrPorts, suggested by Peter Hahndorf does not have this problem. – Eugene Beresovsky Mar 12 '15 at 5:00

You can delete an specific tcp connection with wKillcx.

wKillcx is freeware and you can download it from sourceforge.

Here is an example that how it works at the end of this post:

Windows: Eliminar conexiones activas tcp

share|improve this answer
Is this program virus-free? – Pacerier Jan 23 '15 at 15:38
Yes, wKillcx is virus-free. – AdrianM Feb 11 '15 at 22:56
@AdrianM Can I trust you? – Eugene Beresovsky Mar 12 '15 at 4:45

CurrPorts (cports.exe) from Nirsoft provides a Windows interface to close the ports or at least to identify the processes that are holding it open. This is a pretty good debugging tool - helped me anyway:

Using CurrPorts

The main window of CurrPorts displays the list of all currently opened TCP and UDP ports. You can select one or more items, and then close the selected connections, copy the ports information to the clipboard, or save it to HTML/XML/Text file. If you don't want to view all available columns, or you want to change the order of the columns on the screen and in the files you save, select 'Choose Column' from the View menu, and select the desired columns and their order. In order to sort the list by specific column, click on the header of the desired column.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .