title: The results of ports scanning seem to be incorrect while using AsyncCallback
body: <p>I'm trying to port scan given IP address with range of 20 ports. I know that port 80 is open and all other are closed. My code is showing that all ports are open.</p>
  
  <p>I'm trying to use asynchronous TCPClient to achieve port scan.</p>
  
  <p>What could be wrong here? Have I missed something?</p>
  
  <pre><code>private void btnStart_Click(object sender, EventArgs e)
  {
      for (int port = 80; port &lt; 100; port++)
      {
          ScanPort(port);
      }
  }
  
  private void ScanPort(int port)
  {
      using (TcpClient client = new TcpClient())
      {
          client.BeginConnect(IPAddress.Parse("74.125.226.84"), port, new AsyncCallback(CallBack), client);
      }
  }
  
  private void CallBack(IAsyncResult result)
  {
      using (TcpClient client = (TcpClient)result.AsyncState)
      {
          try
          {
              this.Invoke((MethodInvoker)delegate
              {
                  txtDisplay.Text += "open" + Environment.NewLine;
              });
          }
          catch
          {
              this.Invoke((MethodInvoker)delegate
              {
                  txtDisplay.Text += "closed" + Environment.NewLine;
              });
          }
      }
  }
  </code></pre>
  
  <p>This is what I have now as CallBack method:</p>
  
  <pre><code>    private void CallBack(IAsyncResult result)
      {
          using (TcpClient client = (TcpClient)result.AsyncState)
          {
              client.EndConnect(result);
  
              if (client.Connected)
              {
                  this.Invoke((MethodInvoker)delegate
                  {
                      txtDisplay.Text += "open" + Environment.NewLine;
                  });
              }
              else
              {
                  this.Invoke((MethodInvoker)delegate
                  {
                      txtDisplay.Text += "closed" + Environment.NewLine;
                  });
              }
          }
      }
  </code></pre>