How to kill the TCP ESTABLISHED connection in netstat

Hello,

Actually there are some bugs in application which does not close the TCP connection to other server though CORBA.

We need to kill that ESTABLISHED connections as new connection are not happeneing as the allocated ports were used and showing as ESTABLISHED

Is there any command in UNIX (sun solaris 5.9) to kill the connection that can seen while doing the following

netstat -an |grep <IP address>

I am unable to find the process which started the connection using ps -ef hecnce i cant use kill -9

please help

Regards
Unix beginer

The following command will show you all open files, including the TCP related ones, of all processes running on your system.

pfiles /proc/*

You should be able to easily locate the culprit from its output.

And by the way, please don't gratuitously run "kill -9", that's a poor practice.

Jilliagre you are Brillant !!!

But now I dont know what to do with this out put i can see the connection but how i will kill (will not kill -9 :slight_smile: ) /disconnect am not root in the server

I found out the culpritss by running under the application user in UNIX

Please suggest how i can disconnect these type of connections?? ( it counts more than 80)

Sample out put

 239: S_IFSOCK mode:0666 dev:315,0 ino:4352 uid:0 gid:0 size:0
      O_RDWR
        sockname: AF_INET <my IP>  port: 49389
        peername: AF_INET <destin IP>  port: 3955
 240: S_IFSOCK mode:0666 dev:315,0 ino:40669 uid:0 gid:0 size:0
      O_RDWR
        sockname: AF_INET <my IP>  port: 8103
        peername: AF_INET <destin IP>  port: 10008

Thanks in advance
GIC

You cannot kill connections but you can kill processes. The line you posted show file descriptors 240 and 239. Move back until you reach the first file descriptors open for this process, immediately before, you will find a line telling the maximum number of descriptors and then a line showing the process ID and the command line, just like in that example:

2917:   /usr/lib/firefox/firefox-bin http://www.unix.com/showthread.php?t=1240
  Current rlimit: 512 file descriptors
   0: S_IFCHR mode:0666 dev:323,0 ino:6815752 uid:0 gid:3 rdev:13,2
      O_RDONLY|O_LARGEFILE
      /devices/pseudo/mm@0:null
...

I would run

kill 2917

Thanks for the reply jlliagre,

Due the application urgency we are forced to go for the application (weblogic server restart to kill the connections ) then the connection status went to FIN_WAIT_1 from ESTABLISHED and later on it dissappered. Now BAU.

But the appplication bug is there so we may need to find out other than the application restart.

I followed the way you shown and i have find out the process but again it was the weblogic server running on the system. which means in order to kill the connection i need to kill/stop the weblogic server :frowning:
'

But any way great learning !!

Thanks again for your patience in explaining this :b:

Cheers

GIC