closing a TcpConnection

  • Thread starter Thread starter Dirk Reske
  • Start date Start date
D

Dirk Reske

hello,

I have a class (I call them MyConnection), which establishes a
connection using a TcpClient.
After this connection is established I get the Network stream from the
TcpClient and create a StreamReader and a Streamwriter "on" it!
Then I start a new Thread which reads from the Streamreader.

When I close the connection using TcpClient.Close();
And try to reuse the class by call the constructor again
myConnection = new MyConnection();
It doesn't work correctly?

How to close such a class correctly?
How to safely close the thread?

(excuse my english <- I'm from germany)
 
Hi,

Post your constructor code.

How it does not work correctly?


cheers,
 
Back
Top