Killing host connection

Hi All
Is there a command (or set of commands) that can be used to kill a connection listed in the netstat table? Say there is a host connected to a certain port on your machine, and it is listed via a 'netstat -an', is there a way to issue some commands to 'disconnect' or kill that connection?

I know in HP-UX this can be performed with the ndd command, but how about Linux?

I am using Debian woody kernel 2.4.22.

Thanks!

.....

Knowing the pid won't help if the connection is in FINWAIT2.

.....

Well, yeah but that's because you do things correctly. :slight_smile:

People write servers that connect to pc's. The pc's are powered off. Then someone wants to kill and restart the server. Because connections are in FINWAIT2, the bind fails.

To get into this state they had to:

  1. bypass inetd so that one global bind() is not performed at startup.

  2. connect to clients that fail to do a proper shutdown.

  3. write goofy code so that the server needs to be restarted

  4. forget to set SO_REUSEADDR which would instruct the kernel to ignore the FINWAIT2 connections during a bind()

Believe or not, this happens all the time. Go figure. Many OS's will now time out FINWAIT2 connections which is not good. Other OS's have a way to manually close a FINWAIT2 connection. This is what I think the OP wants.

.....