Can a network connection be killed from the XP command line?
August 19, 2004 9:19 AM   Subscribe

Can a network connection be killed from the command line in Windows XP?
posted by plexi to Technology (12 answers total)
 
ipconfig /release *
posted by dchase at 9:51 AM on August 19, 2004


Do 'netstat -ao' to find the process ID associated with the connection, then 'tskill [process ID]'.
posted by mcguirk at 10:58 AM on August 19, 2004


sometimes that won't work though as the process has already died yet the connection remains open. should time out after a while though.
posted by zeoslap at 11:17 AM on August 19, 2004


As you can tell from the variety of responses, it depends on what you mean by "network connection." Do you want to be unable to send or receive packets on the entire network interface? Or interrupt a particular TCP connection? Or disassociate from a particular SMB file server?

Unfortunately, the term "network connection" is commonly applied to any or all of the above.
posted by majick at 11:22 AM on August 19, 2004


Do you want to disable the NIC from the command line? I am thinking you must be able to do this with netsh, but I cannot find it anywhere, and the documentation for it sucks.
posted by internal at 11:25 AM on August 19, 2004


Response by poster: I was interested in killing a specific connection listed in netstat.
posted by plexi at 12:05 PM on August 19, 2004


sometimes that won't work though as the process has already died yet the connection remains open. should time out after a while though.

Well, in that case it is already closed for all practical purposes--i.e. no new data can be sent. It's just that the protocol has to wait for the connection to shut down cleanly (to ACK the other guy's FIN or whatever).

There is generally no way to close just one socket without killing its entire process, unless you inject a fake RST or something like that.
posted by mcguirk at 12:34 PM on August 19, 2004


When you want to reopen the port is where it would be helpful to be able to release it from the command line after the process has died. I ran into this a while back, messing with sockets had some bad code that crashed and left the port open. Couldn't rebind to that port until it timed out, which can take a while, ended up giving it the three finger salute.
posted by zeoslap at 1:18 PM on August 19, 2004


to ACK the other guy's FIN or whatever

Let's keep it clean, huh?
posted by yerfatma at 1:18 PM on August 19, 2004


When it's your own code you can use the SO_REUSEADDR option on the socket, which will let it bind even when there are lingering connections still around.
posted by mcguirk at 1:57 PM on August 19, 2004


There are pid's in xp, just like linux? I learn something new everyday.
posted by Keyser Soze at 3:58 PM on August 19, 2004


Ooo, didn't know that, thanks mcguirk :)
posted by zeoslap at 8:27 PM on August 19, 2004


« Older Searching "Help"   |   My computer keeps turning back on Newer »
This thread is closed to new comments.