title: C# TCP connection headers
body: <p>I'm trying create program detect DDOS and block their IP, but I use TCP proxy so I cant get real IP :( They send header that contains real ip, but how I can get it? My proxy send header X-Real-IP that contains real IP. I'm currently using this small code get all TCP connections:</p>
  
  <pre><code>private void timer1_Tick(object sender, EventArgs e)
  {
      this.listView1.Items.Clear();
      IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
      TcpConnectionInformation[] connections = properties.GetActiveTcpConnections();
      foreach (TcpConnectionInformation c in connections)
      {
          ListViewItem listViewItemConnectionInformation = new ListViewItem(c.RemoteEndPoint.Address.ToString()); //from ip
          listViewItemConnectionInformation.SubItems.Add(c.LocalEndPoint.Address.ToString()); //to ip
          listViewItemConnectionInformation.SubItems.Add(c.RemoteEndPoint.Port.ToString()); //from port
          listViewItemConnectionInformation.SubItems.Add(c.LocalEndPoint.Port.ToString()); //to port
          listViewItemConnectionInformation.SubItems.Add(""); //real ip
          this.listView1.Items.Add(listViewItemConnectionInformation);
      }
  }
  </code></pre>