tags:

views:

80

answers:

2

How can i terminate a tcp connection wich is not handled by my program?

for example i want to close all the connection on port 10202 and i dont want them to reopen but i want to allow the other ports everything in C#

like Sysinternals' tcpView does

+2  A: 

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.

bramp
+2  A: 

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.

Stephen Cleary