Close an external TCP connection
How can I terminate a TCP connection which is not handled by my program?
for exam开发者_如何学Gople I want to close all the connection on port 10202 and I don't want them to reopen, but I want to allow the other ports. everything in C#.
like Sysinternals' tcpView does
You'd have to p/Invoke SetTcpEntry
. TCPView uses Dark and Mysterious Methods to do the same even on platforms that don't support that function.
I don't know how TCPView does it, but you could generate a TCP Fin packet and fire it at yourself.
I don't know how to do that in C#, but you might be able to find a way.
精彩评论