Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Command Line Tool to close a connection

Posted on 2004-09-08
6
Medium Priority
?
249 Views
Last Modified: 2010-04-11
I have what I hope is a simple question:

How can I close an unwanted tco/ip session from the command line?

I've been running the netstat tool to keep an eye on things, and occasionally I'll have a connection that I don't want but can't terminate.  Since it's not a file share, I don't know of any way to target the connection and cut it off.  Any ideas?
0
Comment
Question by:Zeek0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 14

Expert Comment

by:kenfcamp
ID: 12007784
What OS are you using?

Under linux:

type who to get the TTY the offending connection is using
<user>       pts/0    Sep  8 11:52
<user>       pts/1    Sep  8 11:52

type ps -ax to get running processes

PID TTY      STAT   TIME COMMAND
31513 pts/1    S      0:00 -bash
31586 pts/0    S      0:00 -bash

as root type kill -9 <PID>

If pts/0 was the offending connection (using the above example) you'd type

kill -9 31586 (as root)

Hope this helps

KC

0
 

Author Comment

by:Zeek0
ID: 12008195
Unfortunately, I'm asking about how to do it in XP.  It seems like an obvious task, but I haven't ever seen a way to do it - I'd prefer to use the command line, but any other strategies would be fine.
0
 
LVL 14

Expert Comment

by:kenfcamp
ID: 12008352
Home or pro?
0
Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

 

Author Comment

by:Zeek0
ID: 12008646
pro
0
 
LVL 14

Accepted Solution

by:
kenfcamp earned 200 total points
ID: 12008972
Do you generaly know the PID of the offending connection/service ?

If so try taskkill /PID <pid number>

ELSE

Type tasklist to obtain a list of running processes
Locate the PID you're looking to kill
type taskkill /pid <pid number>

KC
0
 
LVL 14

Expert Comment

by:kenfcamp
ID: 12008996
PS

To test this (play with it)

open 1 or 2 cmd consoles

as admin open a console and go to it..

NOTE: You will not be able to close down the cmd PID you're running the commands on

KC
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had an issue with InstallShield not being able to use Computer Browser service on Windows Server 2012. Here is the solution I found.
This program is used to assist in finding and resolving common problems with wireless connections.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question