0

I want to close an existing TCP connection on a given server. the connection is not control by the C# application, but since I know the source IP and source port, destination IP and destination Port, I would like to terminate this connection using C#.

How can I do that? Thanks

user2993562
  • 51
  • 1
  • 7

2 Answers2

1

You can form a TCP reset packet, but it's a complex solution.

DarkWanderer
  • 8,739
  • 1
  • 25
  • 56
1

If you have an API that gives you access to your network card driver (very unlikely) you might.

In general this is not possible in Windows, it is protected by the system: only the process that owns the socket handle can close it.

quantdev
  • 23,517
  • 5
  • 55
  • 88
  • 3
    Not true, [TcpView](http://technet.microsoft.com/en-us/sysinternals/bb897437), [Netlimiter](http://www.netlimiter.com/) can do that AFAIK. – Sriram Sakthivel May 29 '14 at 09:46