Several times in the past, I've run across the need to shut down a single network socket for a program that had several open. The best solution I've come up with is target the particular host it was connected to (that is, the one I want to d/c) and fire up iptables.
I find this solution somewhat clunky, and I really don't like having to do it. Granted, I need this ability very often, it'd nice to have.
So, my question is, is there some system call, or standard tool that I don't know about, that allows me to force-close a network socket? My other attempt would be to just inject a RST with nemesis orso, but I'd rather do it what I would consider a 'proper' way.
Is there anything like this out there? Or is this something the kernel doesn't even really support at this time?