title: C# UDPClient not receiving packets over external IP
body: <p>So here's the thing, i'm creating a server/client environment for a game where a port forwarded computer acts as a server, and clients send the first UDP message to connect and get the accept message then start sending the in-game UDP messages after successfully connecting.
  The problem is, when I use the local IPs say the server using 10.0.0.7 and a client is using 10.0.0.4, everything works just fine:</p>
  
  <ol>
  <li>Client sends connect message.</li>
  <li>Server receives it.</li>
  <li>Servers sends back accept message.</li>
  <li>Client receives it</li>
  <li>All further messages reach both ends without any problem.</li>
  </ol>
  
  <p>But when I use the external IP: </p>
  
  <ol>
  <li>Client sends connect message.</li>
  <li>Server receives it.</li>
  <li>Servers sends back accept message.</li>
  <li>Client receives it</li>
  <li>Both ends can send messages but the client doesn't receive any more messages.</li>
  </ol>
  
  <p>Wanted to know at the end if the problem is somehow from the code, or from what I think it's really from, router, NAT, firewalls or anything like that.
  (Note: Client sends to server's 8888 port, and server sends back through the client's local port, as it should be.)</p>
  
  <p>Below is the client code, written for Unity:</p>
  
  <pre><code>void Start()
  {
      client = new UdpClient();
      client.Connect(IPAddress.Parse("&lt;Global IP&gt;"), 8888);
      client.BeginReceive(new AsyncCallback(ReadMessage), client);
  }
  
  private void ReadMessage(IAsyncResult result)
  {
      IPEndPoint ipEndPoint = null;
      string message = Encoding.ASCII.GetString(client.EndReceive(result, ref ipEndPoint));
      print("Got: " + message);
      string[] wholeMessages = message.Split('#');
      for (int w = 0; w &lt; wholeMessages.Length - 1; w++)
      {
  
  
          string[] parts = wholeMessages[w].Split('$');
          if (!connected &amp;&amp; parts.Length == 3 &amp;&amp; parts[0] == "accept" &amp;&amp; int.TryParse(parts[1], out ID))
          {
              connected = true;
              code = parts[2];
          }
      }
      client.BeginReceive(new AsyncCallback(ReadMessage), client);
  }
  
  public void SendUDP(string message)
  {
      client.Send(Encoding.ASCII.GetBytes(message), message.Length);
  }
  </code></pre>