I've search around and all the suggestions just say to kill the process. But I'm surprised I can't find any simple way to force a "connection" to close, without killing a pid associated with it.

iptables seems like a terrible solution, as i don't want add rules to block a whole service, or kill all connections. I just want to kill or force closed one existing connection, and not affect any other connections or future connections.

Ideally, the processes on both sides would see just the connection close, or at worst, stop responding.

  • If you let us know why you'd want to do that and what you're trying to achieve, we just might be able to help you. superuser.com/questions/how-to-ask – user 99572 is fine Mar 5 '13 at 21:01
  • Oh all sorts of reasons. Simulating dropped connections or poor network conditions. Forcing specific clients to reconnect. Rejecting clients after a certain amount of time or workload. More complicated access control. – DragonFax Mar 6 '13 at 6:50

If you know something about the connection (ip, host, port), you can use this command:

tcpkill host


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.