private void sendBtn_Click(object sender, System.EventArgs e)
{
try 
{
if(this.stream != null) 
{
string msg = sendDataTB.Text;
// Translate the passed message into ASCII and store it as a Byte array.
Byte[] data = System.Text.Encoding.ASCII.GetBytes(msg.ToCharArray());
//Byte[] data = System.Text.Ecoding.Default.GetString(msg);
//  System.Text.Ecoding.Default.GetString
// Send the message to the connected TcpServer. 
stream.Write(data, 0, data.Length);
this.dataTB.Text += "DEMO: "+msg + "\r\n";
Byte[] svrData = new Byte[256]; // String to store the response ASCII representation.
String responseData = String.Empty; // Read the first batch of the TcpServer response bytes.
Int32 bytes = stream.Read(svrData, 0, svrData.Length);
responseData = System.Text.Encoding.ASCII.GetString(svrData, 0, bytes);
// responseData = System.Text.Ecoding.Default.GetString(svrData, 0, bytes);
this.dataTB.Text += "SERVER: "+ responseData + "\r\n";

else 
{
throw new Exception("Connection stream is null");
}

catch(InvalidOperationException ioex) 
{}}