title: No connection could be made because the target machine actively refused it why?
body: <p>Hi I am using TCPCLient and TCPlitner to transmit data but i am getting error not to connect 
  below is my Code</p>
  
  <pre><code> private void button1_Click(object sender, EventArgs e)
   {
      TcpClient tcpc = new TcpClient("192.168.21.46", 10);            
      NetworkStream nts = tcpc.GetStream();
      if (nts.CanWrite)
      {
           Byte[] sends = System.Text.Encoding.ASCII.GetBytes(textBox1.Text.ToCharArray());
           nts.Write(sends, 0, sends.Length);
           nts.Flush();
      }
  }
  
  private void button2_Click(object sender, EventArgs e)
  {
      TcpListener myListener = new TcpListener(10);
      myListener.Start();
      while (true)
      {
          //Accept a new connection
          Socket mySocket = myListener.AcceptSocket();
          if (mySocket.Connected)
          {                   
              //make a byte array and receive data from the client 
              Byte[] receive = new Byte[64];
              int i = mySocket.Receive(receive, receive.Length, 0);
              char[] unwanted = { ' ', ' ', ' ' };
              string rece = System.Text.Encoding.ASCII.GetString(receive);
              label1.Text = rece.TrimEnd(unwanted);                  
          }
      }
  }
  </code></pre>
  
  <p>this two buttons i have added in the same form and Ip apddress which is mentioned is my systems IP Address. Can anyone tell me why this Happen. Even I remove firewall setting also.</p>