How to properly and completely close/reset a TcpClient connection?

You have to close the stream before closing the connection:

tcpClient.GetStream().Close();
tcpClient.Close();

Closing the client does not close the stream.

Leave a Comment