title: Can't get public IP programatically, router settings issues?
body: <p>In my program I am getting the local machine's public IP address like this</p>
  
  <pre><code>public static IPAddress getIPAddress()
  {
      IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName());
      foreach (IPAddress addr in localIPs)
      {
          if (addr.AddressFamily == AddressFamily.InterNetwork)
          {
              return addr;
          }
      }
      return null;
  }
  </code></pre>
  
  <p>and it worked fine where I live.</p>
  
  <p>Right now I am at a friend's house, and I am connected to internet via Wi-Fi, and this code does not give me my external IP address, it has probably something to do with the router settings, but I am not very familiar with networks...</p>
  
  <p>The router is TP-LINK, and I can access its settings like this
  <img src="https://i.stack.imgur.com/U0kEu.png" alt="enter image description here"></p>
  
  <p>By the way, the 8080 port is exactly the one I need, I only need to be able to access my public IP. How can I do it?</p>