//flex table opened by JP

Click to See Complete Forum and Search --> : Killing A Port Connection Manually (?????)


spiderbot
09-09-2001, 01:14 AM
First off, I would just like to thank all of the members who have helped me in the past. Thanks, I really appreciate it! http://www.sysopt.com/forum/smile.gif

My question is.....when you are in the MS-DOS prompt and type in "netstat -an", you get a list of all active connections. But WHICH command would I use to kill/terminate one of those active connections which were listed when I typed in the command "netstat -an"?????

Thank you very much,
-SpiderBot

smokin1
09-09-2001, 04:03 PM
Correct me if I'm wrong..and I'm sure someone will...but my understanding of windows is that all the ports are there for the taking unless there is a router or a firewall in place to allow/disallow connections. Even filtering is done at the router level. Netstat will show what is happening, but in windows..that's about it..you know what is going on..sort of (you can't always tell what the process is)..but without add on hardware or software, there isn't much you can do about it..short of unplugging the modem...

DVNT1
09-11-2001, 04:05 AM
If you are desperate you could change the routing table for the unwanted IP address that is connecting to your computer.

This is a very "manual" way to do it but effective.

At a command prompt type...

[b] route add 10.10.10.2 192.168.1.250

...sustitute 10.10.10.10.2 with the offending IP address and substitute 192.168.1.250 with a ficticious IP address on your network.

This would last until you reboot.

knucklebusted
09-12-2001, 08:41 PM
You might try something like Zone Alarm. That would allow you to know what was using the connection and then lock it down if you deem it not worthy.

Otherwise, if it is a port built into Windows, such as File and Printer Sharing, you will have to stop that service by removing the shares. If it is a program you are running such as IRC or a Web Server, you would need to stop that server/service.

SoopaStar
09-12-2001, 09:00 PM
C:\>route add

Manipulates network routing tables.

ROUTE [-f] [-p] [command [destination]
[MASK netmask] [gateway] [METRIC metric] [IF interface]

-f Clears the routing tables of all gateway entries. If this is
used in conjunction with one of the commands, the tables are
cleared prior to running the command.
-p When used with the ADD command, makes a route persistent across
boots of the system. By default, routes are not preserved
when the system is restarted. Ignored for all other commands,
which always affect the appropriate persistent routes. This
option is not supported in Windows 95.
command One of these:
PRINT Prints a route
ADD Adds a route
DELETE Deletes a route
CHANGE Modifies an existing route
destination Specifies the host.
MASK Specifies that the next parameter is the 'netmask' value.
netmask Specifies a subnet mask value for this route entry.
If not specified, it defaults to 255.255.255.255.
gateway Specifies gateway.
interface the interface number for the specified route.
METRIC specifies the metric, ie. cost for the destination.

All symbolic names used for destination are looked up in the network database
file NETWORKS. The symbolic names for gateway are looked up in the host name
database file HOSTS.

If the command is PRINT or DELETE. Destination or gateway can be a wildcard,
(wildcard is specified as a star '*'), or the gateway argument may be omitted.

If Dest contains a * or ?, it is treated as a shell pattern, and only
matching destination routes are printed. The '*' matches any string,
and '?' matches any one char. Examples: 157.*.1, 157.*, 127.*, *224*.
Diagnostic Notes:
Invalid MASK generates an error, that is when (DEST & MASK) != DEST.
Example> route ADD 157.0.0.0 MASK 155.0.0.0 157.55.80.1 IF 1
The route addition failed: The specified mask parameter is invalid.
(Destination & Mask) != Destination.

Examples:

> route PRINT
> route ADD 157.0.0.0 MASK 255.0.0.0 157.55.80.1 METRIC 3 IF 2
destination^ ^mask ^gateway metric^ ^
Interface^
If IF is not given, it tries to find the best interface for a given
gateway.
> route PRINT
> route PRINT 157* .... Only prints those matching 157*
> route DELETE 157.0.0.0
> route PRINT

Thought I would paste that so he had the whole list. What port are you having problems with? Maybe there is a chance a connection is supposed to be there and you aren't familiar with it?

Paul

cadetstimpy
09-12-2001, 10:44 PM
If your using WinNt40 or Win2k then those same connections your seeing can also be seen and terminated as follows:

WinNt40
In Control Panel click the server icon. Click the sessions icon to see the list of connections. From here you can diconnect users.

Win2k
Right Click My Computer and select Manage. Expand shared folders and look in the sessions sufolder. Right click a given session and disconnect at your discretion.

cadetstimpy
09-12-2001, 10:46 PM
Win9x has a similiar utility called NetWatcher, but it has to be added as a windows component in add/remove programs.

ScaryBinary
05-20-2004, 01:23 AM
Brought this one back from the dead, huh?

I was looking for this myself and found a way to do it. Using the netstat -o command will display the Process ID of the process currently holding the port. You can then go into Task Manager (and add the PID column in the processes tab if it's not there) and kill that process if you feel that's necessary.

Like someone else mentioned, that won't keep some other application from using the port later, but it can be used to kill a process currently using the port.

My tiny, probably useless contribution to Sysopt. :rolleyes:

I'm laughing at the thought of Spiderbot getting an e-mail telling him that there's a response to a question he asked 3 years ago...