Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

to kill a port 2

Status
Not open for further replies.

babeo

Technical User
Mar 30, 2000
398
CA
Hi,
I have a process running, and I want to stop, so I kill the process, however, when I use netstat -n, I still it ESTABLISH, how can I kill the port connection?
Thanks
 
Download and install lsof from sunfreeware.com, if you don't have it already. Then you can use lsof -i :<portnumber> to identify which process is holding that connection open.

Annihilannic.
 
Cool,
Thanks Annihilannic,
Do you experience this freeware? I means is there any issue with it? (I have java, xml, samba, and ArcServer running on this server), I guess the installation is straight forward, and no need to reboot?
 
[tt]lsof[/tt] is great! We have it installed on all machines including production machines. We've never had any problems with it and the information it provides it very valuable.

 
In certain cases the process that opened the connection will no longer exist... The following procedure may allow you to terminate the hung tcp connection ....

Example configuration :

Local IP = 10.10.4.8 Hex= 0x0a0a0408
Local Port = 8002 Hex= 0x1f42

Remote IP= 10.10.140.47 Hex= 0x0a0a8c2f
Remote Port = 1319 Hex= 0x0527

Command :

ndd –set /dev/tcp tcp_discon_by_addr
“0a0a04081f42 0a0a8c2f0527”



Roger Bosley
 
babo:

lsof does not involve any kernel mods, it is simply perusing the kernel/user memory image maps in /proc. There is no need to reboot.

I generally trust the sunfreeware stuff, BUT:

It might be out of date.

It might be built with configs that don't apply or won't work for you.

Some things are path dependent.

gene
 
Yep, lsof is extremely useful alright, the only negative I have found is that it runs very slowly on Solaris (usually instantaneous under Linux) and uses significant system resources while running.

Annihilannic.
 
tcp_discon_by_addr" does not appear to be present on our Sun-Fire V210 (Solaris9) system. "ndd /dev/tcp \?" confirms
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top