title: C# TCP connect, client cannot send message to server
body: <p>Why I cannot send message to server, can anyone help me? programming language is C#, I have turned off my firewall but it's still not work.</p>
  <p>Why I cannot send message to server, can anyone help me? programming language is C#, I have turned off my firewall but it's still not work.</p>
  <p>Here is my server</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  using SimpleTCP;
  
  namespace TCP
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          SimpleTcpServer server;
  
          private void Form1_Load(object sender, EventArgs e)
          {
              server = new SimpleTcpServer();
              server.Delimiter = 0x13;
              server.StringEncoder = Encoding.UTF8;
              server.DataReceived += Server_DataReceived;
          }
  
          private void Server_DataReceived(object sender, SimpleTCP.Message e)
          {
              txtStatus.Invoke((MethodInvoker)delegate ()
              {
                  txtStatus.Text += e.MessageString;
                  e.ReplyLine(string.Format(&quot;You said: {0}&quot;, e.MessageString));
              });
          }
  
          private void btnStart_Click(object sender, EventArgs e)
          {
              txtStatus.Text += &quot;Server starting...&quot;;
              System.Net.IPAddress ip = System.Net.IPAddress.Parse(txtHost.Text);
              server = new SimpleTcpServer().Start(ip, Convert.ToInt32(txtPort.Text));
              txtStatus.Text += Environment.NewLine + &quot;Server connected!&quot;;
              //server.Start(ip, Convert.ToInt32(txtPort.Text));
          }
  
          private void btnStop_Click(object sender, EventArgs e)
          {
              if (server.IsStarted)
                  server.Stop();
          }      
      }
  }
  </code></pre>
  <p>Here is my client</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  using SimpleTCP;
  
  namespace Client
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
   
          SimpleTcpClient client;
   
          private void btnConnect_Click(object sender, EventArgs e)
          {
              btnConnect.Enabled = false;
              //Connect to server
              client.Connect(txtHost.Text, Convert.ToInt32(txtPort.Text));
          }
   
          private void Form1_Load(object sender, EventArgs e)
          {
              client = new SimpleTcpClient();
              client.StringEncoder = Encoding.UTF8;
              client.DataReceived += Client_DataReceived;
          }
   
          private void Client_DataReceived(object sender, SimpleTCP.Message e)
          {
              //Update message to txtStatus
              txtStatus.Invoke((MethodInvoker)delegate ()
              {
                  txtStatus.Text += e.MessageString;               
              });
          }
   
          private void btnSend_Click(object sender, EventArgs e)
          {
              client.WriteLineAndGetReply(txtMessage.Text, TimeSpan.FromSeconds(0));
          }
      }
  }
  </code></pre>
  <p>I don't know if I have problem with connection or message problem</p>