//private string GetMessage() //{ // var data = new byte[64]; // var builder = new StringBuilder(); // var bytes = 0; // do // { // bytes = NStream.Read(data, 0, data.Length); // builder.Append(Encoding.Unicode.GetString(data, 0, bytes)); // } // while (NStream.DataAvailable); // return builder.ToString(); //} public void Close() { if (NStream != null) { NStream.Close(); } if (tcpClient != null) { tcpClient.Close(); } }