I was wondering if it's possible to use .NET to disable a certain network interface or, in alternative, to drop all the existing TCP connections (from the whole system) and then inhibit further creation.
I'm asking this because I want to write a small C# utility that monitors the system and blocks networking (or at least TCP connections) for a certain amount of time if the overall speed drops below a threshold. And then I'd want it to restore connectivity after a certain number of minutes.
From what I understand monitoring a NIC throughput from within .NET is fairly easy. But I don't know if it's possible to block a whole NIC or TCP connections.
Maybe with P/Invoke and WMI?